Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

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