Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
#include 16C84.INC
2
 
3
	org	0
4
 
5
	goto	Start
6
	;--------------------
7
	org	4
8
	;--------------------
9
 
10
Start:
11
	page1
12
	movlw 	00000000B	; inicializace citace a prescaleru
13
	movwf	TMR0
14
	movlw 	00000000B	; konfigurace preruseni
15
	movwf	INTCON
16
 
17
	page1
18
	movlw	11110111B	; nastaveni portu na vstup nebo vystup
19
	movwf	PORTA		; 1=vstup 0=vystup
20
	movlw	11110001B
21
	movwf	PORTB
22
 
23
	bsf	TMR0, 7		; vypni pull-up na PORTB (OPTION registr)
24
 
25
	page0
26
 
27
	clrw			; vynulovani portu
28
	movwf	PORTA
29
	movwf	PORTB
30
 
31
	bsf	PORTA, 3	; Pull-Up na tlacitka
32
 
33
	bcf	PORTB, 1	; zhasnuti LED
34
	bcf	PORTB, 2
35
	bcf	PORTB, 3
36
 
37
MainLoop:
38
	movlw	2
39
	movwf	volani		; Nastavi pocet volani procedury vibito	
40
	;bsf	PORT		; Nabiti kondenzatoru1
41
	;bsf	PORT		; Nabiti kondenzatoru2
42
dal:
43
	btfss	PORTA, 1	; Test kondenzatoru1
44
	call	vibito
45
 
46
	bsf	PORTB, 2
47
	call	Delay10ms
48
	call	Delay10ms	
49
	call	Delay10ms
50
	call	Delay10ms
51
	call	Delay10ms
52
	bcf	PORTB, 2
53
	call	Delay10ms
54
	call	Delay10ms	
55
	call	Delay10ms
56
	call	Delay10ms
57
	call	Delay10ms
58
 
59
	bsf	PORTB, 2
60
	call	Delay10ms
61
	call	Delay10ms	
62
	call	Delay10ms
63
	call	Delay10ms
64
	call	Delay10ms
65
	bcf	PORTB, 2	
66
 
67
 
68
 
69
 
70
 
71
	btfss	PORTB, 6	; Test kondenzatoru2
72
	call	vibito
73
	incf	Ramec, f
74
	goto	dal
75
	;---------------
76
 
77
Delay10us:			; Prodleva (DELAY10 * 10us)+3us
78
	nop	
79
	nop
80
	nop
81
	nop
82
	nop
83
	nop
84
	nop
85
	decfsz	CT1, 1
86
	goto	Delay10us
87
	return
88
	;-------------------------
89
Sinchro:
90
	bsf	PORTB, 1
91
	call	Delay10ms		
92
	call	Delay10ms	
93
	call	Delay10ms	
94
	bcf	PORTB, 1		; 1 impuls (30ms)
95
	call	Delay10ms
96
	call	Delay10ms
97
	call	Delay10ms		
98
	bsf	PORTB, 1
99
	call	Delay10ms		
100
	call	Delay10ms	
101
	bcf	PORTB, 1		; 2 impuls (20ms)
102
	call	Delay10ms
103
	call	Delay10ms			
104
	bsf	PORTB, 1
105
	call	Delay10ms		
106
	bcf	PORTB, 1		; 3 impuls (10ms)
107
	call	Delay10ms
108
 
109
	return
110
	;-------------------------
111
Delay10ms:
112
	movlw	100
113
	movwf	CT2
114
	call	Delay10us
115
	decfsz	CT2, f
116
	goto	Delay10ms
117
	return
118
	;-------------------------
119
Protokol:
120
	movlw	8
121
	movwf	Bity			; nastaveni slova
122
	call	Sinchro
123
VysBit:
124
	btfss	Ramec, 0
125
	call	frek0
126
	call	frek1
127
	rrf	Ramec, f
128
	decfsz	Bity, f
129
	goto	VysBit
130
	return
131
 
132
	;-------------------------
133
frek0:
134
	;-------------------------
135
frek1:
136
	;-------------------------
137
vibito:
138
	movlw	4
139
	movwf	CT1				; uvolneni mista
140
zapis:	
141
	rlf	Ramec, f
142
	decfsz	CT1, f
143
	goto	zapis
144
	decfsz	volani, f
145
	return
146
	call	Protokol
147
	call	MainLoop
148
;----------------------------
149
; Definice promenych
150
;----------------------------
151
 
152
	cblock	
153
 
154
	CT1
155
	CT2
156
	Bity
157
	Ramec
158
	volani
159
	XXX
160
 
161
	endc
162
 
163
	end