135 |
jicha |
1 |
CCS PCM C Compiler, Version 4.059d, 15399 13-I-06 22:52 |
|
|
2 |
|
|
|
3 |
Filename: C:\RS\Ladicka\main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 415 words (20%) |
|
|
6 |
Largest free fragment is 1633 |
|
|
7 |
RAM used: 14 (4%) at main() level |
|
|
8 |
39 (11%) worst case |
|
|
9 |
Stack: 2 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 00 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 0F8 |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include "C:\RS\Ladicka\main.h" |
|
|
17 |
.................... #include <16F877A.h> |
|
|
18 |
.................... //////// Standard Header file for the PIC16F877A device //////////////// |
|
|
19 |
.................... #device PIC16F877A |
|
|
20 |
.................... #list |
|
|
21 |
.................... |
|
|
22 |
.................... #device adc=8 |
|
|
23 |
.................... |
|
|
24 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
25 |
.................... #FUSES XT //Crystal osc <= 4mhz |
|
|
26 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
27 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
28 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
29 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
30 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
31 |
.................... #FUSES NOCPD //No EE protection |
|
|
32 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
33 |
.................... |
|
|
34 |
.................... #use delay(clock=4000000,RESTART_WDT) |
|
|
35 |
* |
|
|
36 |
002D: MOVLW 24 |
|
|
37 |
002E: MOVWF 04 |
|
|
38 |
002F: BCF 03.7 |
|
|
39 |
0030: MOVF 00,W |
|
|
40 |
0031: BTFSC 03.2 |
|
|
41 |
0032: GOTO 044 |
|
|
42 |
0033: MOVLW 01 |
|
|
43 |
0034: MOVWF 78 |
|
|
44 |
0035: MOVLW BF |
|
|
45 |
0036: MOVWF 77 |
|
|
46 |
0037: CLRWDT |
|
|
47 |
0038: DECFSZ 77,F |
|
|
48 |
0039: GOTO 037 |
|
|
49 |
003A: DECFSZ 78,F |
|
|
50 |
003B: GOTO 035 |
|
|
51 |
003C: MOVLW 4A |
|
|
52 |
003D: MOVWF 77 |
|
|
53 |
003E: DECFSZ 77,F |
|
|
54 |
003F: GOTO 03E |
|
|
55 |
0040: NOP |
|
|
56 |
0041: CLRWDT |
|
|
57 |
0042: DECFSZ 00,F |
|
|
58 |
0043: GOTO 033 |
|
|
59 |
0044: GOTO 159 (RETURN) |
|
|
60 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
|
|
61 |
.................... |
|
|
62 |
.................... |
|
|
63 |
.................... #define krok 1 |
|
|
64 |
.................... #define vstup C1OUT |
|
|
65 |
.................... |
|
|
66 |
.................... void main() |
|
|
67 |
.................... { |
|
|
68 |
* |
|
|
69 |
00F8: CLRF 04 |
|
|
70 |
00F9: BCF 03.7 |
|
|
71 |
00FA: MOVLW 1F |
|
|
72 |
00FB: ANDWF 03,F |
|
|
73 |
00FC: MOVLW 19 |
|
|
74 |
00FD: BSF 03.5 |
|
|
75 |
00FE: MOVWF 19 |
|
|
76 |
00FF: MOVLW A6 |
|
|
77 |
0100: MOVWF 18 |
|
|
78 |
0101: MOVLW 90 |
|
|
79 |
0102: BCF 03.5 |
|
|
80 |
0103: MOVWF 18 |
|
|
81 |
0104: BSF 03.5 |
|
|
82 |
0105: BSF 1F.0 |
|
|
83 |
0106: BSF 1F.1 |
|
|
84 |
0107: BSF 1F.2 |
|
|
85 |
0108: BCF 1F.3 |
|
|
86 |
0109: MOVLW 07 |
|
|
87 |
010A: MOVWF 1C |
|
|
88 |
.................... int16 n; |
|
|
89 |
.................... short ENABLE; |
|
|
90 |
.................... short off; |
|
|
91 |
.................... |
|
|
92 |
.................... setup_adc_ports(NO_ANALOGS); |
|
|
93 |
* |
|
|
94 |
010E: BSF 03.5 |
|
|
95 |
010F: BSF 1F.0 |
|
|
96 |
0110: BSF 1F.1 |
|
|
97 |
0111: BSF 1F.2 |
|
|
98 |
0112: BCF 1F.3 |
|
|
99 |
.................... setup_adc(ADC_OFF); |
|
|
100 |
0113: BCF 03.5 |
|
|
101 |
0114: BCF 1F.0 |
|
|
102 |
.................... setup_psp(PSP_DISABLED); |
|
|
103 |
0115: BSF 03.5 |
|
|
104 |
0116: BCF 09.4 |
|
|
105 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
106 |
* |
|
|
107 |
010B: MOVLW FF |
|
|
108 |
010C: BCF 03.5 |
|
|
109 |
010D: MOVWF 20 |
|
|
110 |
* |
|
|
111 |
0117: BCF 03.5 |
|
|
112 |
0118: BCF 14.5 |
|
|
113 |
0119: BCF 20.5 |
|
|
114 |
011A: MOVF 20,W |
|
|
115 |
011B: BSF 03.5 |
|
|
116 |
011C: MOVWF 07 |
|
|
117 |
011D: BCF 03.5 |
|
|
118 |
011E: BSF 20.4 |
|
|
119 |
011F: MOVF 20,W |
|
|
120 |
0120: BSF 03.5 |
|
|
121 |
0121: MOVWF 07 |
|
|
122 |
0122: BCF 03.5 |
|
|
123 |
0123: BCF 20.3 |
|
|
124 |
0124: MOVF 20,W |
|
|
125 |
0125: BSF 03.5 |
|
|
126 |
0126: MOVWF 07 |
|
|
127 |
0127: MOVLW 01 |
|
|
128 |
0128: BCF 03.5 |
|
|
129 |
0129: MOVWF 14 |
|
|
130 |
012A: MOVLW 00 |
|
|
131 |
012B: BSF 03.5 |
|
|
132 |
012C: MOVWF 14 |
|
|
133 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
134 |
012D: MOVF 01,W |
|
|
135 |
012E: ANDLW C7 |
|
|
136 |
012F: IORLW 08 |
|
|
137 |
0130: MOVWF 01 |
|
|
138 |
.................... setup_timer_1(T1_DISABLED); |
|
|
139 |
0131: BCF 03.5 |
|
|
140 |
0132: CLRF 10 |
|
|
141 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
142 |
0133: MOVLW 00 |
|
|
143 |
0134: MOVWF 78 |
|
|
144 |
0135: MOVWF 12 |
|
|
145 |
0136: MOVLW 00 |
|
|
146 |
0137: BSF 03.5 |
|
|
147 |
0138: MOVWF 12 |
|
|
148 |
.................... setup_comparator(A0_VR_A1_VR); |
|
|
149 |
0139: MOVLW 06 |
|
|
150 |
013A: MOVWF 1C |
|
|
151 |
013B: MOVF 05,W |
|
|
152 |
013C: IORLW 03 |
|
|
153 |
013D: MOVWF 05 |
|
|
154 |
013E: CLRWDT |
|
|
155 |
013F: MOVLW 02 |
|
|
156 |
0140: MOVWF 77 |
|
|
157 |
0141: DECFSZ 77,F |
|
|
158 |
0142: GOTO 141 |
|
|
159 |
0143: GOTO 144 |
|
|
160 |
0144: MOVF 1C,W |
|
|
161 |
0145: BCF 03.5 |
|
|
162 |
0146: BCF 0D.6 |
|
|
163 |
.................... setup_vref(VREF_LOW|0); |
|
|
164 |
0147: MOVLW A0 |
|
|
165 |
0148: BSF 03.5 |
|
|
166 |
0149: MOVWF 1D |
|
|
167 |
.................... |
|
|
168 |
.................... while(TRUE) |
|
|
169 |
.................... { |
|
|
170 |
.................... off=0; |
|
|
171 |
014A: BCF 03.5 |
|
|
172 |
014B: BCF 23.1 |
|
|
173 |
.................... ENABLE=1; |
|
|
174 |
014C: BSF 23.0 |
|
|
175 |
.................... while(vstup); |
|
|
176 |
014D: BSF 03.5 |
|
|
177 |
014E: BTFSC 1C.6 |
|
|
178 |
014F: GOTO 14E |
|
|
179 |
.................... for(n=1;ENABLE;n++) |
|
|
180 |
0150: BCF 03.5 |
|
|
181 |
0151: CLRF 22 |
|
|
182 |
0152: MOVLW 01 |
|
|
183 |
0153: MOVWF 21 |
|
|
184 |
0154: BTFSS 23.0 |
|
|
185 |
0155: GOTO 16E |
|
|
186 |
.................... { |
|
|
187 |
.................... delay_ms(krok); |
|
|
188 |
0156: MOVLW 01 |
|
|
189 |
0157: MOVWF 24 |
|
|
190 |
0158: GOTO 02D |
|
|
191 |
.................... if(vstup)off=1; |
|
|
192 |
0159: BSF 03.5 |
|
|
193 |
015A: BTFSS 1C.6 |
|
|
194 |
015B: GOTO 15F |
|
|
195 |
015C: BCF 03.5 |
|
|
196 |
015D: BSF 23.1 |
|
|
197 |
015E: BSF 03.5 |
|
|
198 |
.................... if((!vstup)&(off))ENABLE=0; |
|
|
199 |
015F: MOVLW 00 |
|
|
200 |
0160: BTFSS 1C.6 |
|
|
201 |
0161: MOVLW 01 |
|
|
202 |
0162: BCF 03.5 |
|
|
203 |
0163: MOVWF 24 |
|
|
204 |
0164: MOVLW 00 |
|
|
205 |
0165: BTFSC 23.1 |
|
|
206 |
0166: MOVLW 01 |
|
|
207 |
0167: ANDWF 24,W |
|
|
208 |
0168: BTFSS 03.2 |
|
|
209 |
0169: BCF 23.0 |
|
|
210 |
.................... } |
|
|
211 |
016A: INCF 21,F |
|
|
212 |
016B: BTFSC 03.2 |
|
|
213 |
016C: INCF 22,F |
|
|
214 |
016D: GOTO 154 |
|
|
215 |
.................... printf("Doba mezi stisknutim byla %5.3w s.\n\r",n-1); |
|
|
216 |
016E: MOVLW 01 |
|
|
217 |
016F: SUBWF 21,W |
|
|
218 |
0170: MOVWF 24 |
|
|
219 |
0171: MOVF 22,W |
|
|
220 |
0172: MOVWF 25 |
|
|
221 |
0173: MOVLW 00 |
|
|
222 |
0174: BTFSS 03.0 |
|
|
223 |
0175: MOVLW 01 |
|
|
224 |
0176: SUBWF 25,F |
|
|
225 |
0177: CLRF 26 |
|
|
226 |
0178: MOVF 26,W |
|
|
227 |
0179: CALL 004 |
|
|
228 |
017A: INCF 26,F |
|
|
229 |
017B: MOVWF 77 |
|
|
230 |
017C: MOVF 77,W |
|
|
231 |
017D: BTFSS 0C.4 |
|
|
232 |
017E: GOTO 17D |
|
|
233 |
017F: MOVWF 19 |
|
|
234 |
0180: MOVLW 1A |
|
|
235 |
0181: SUBWF 26,W |
|
|
236 |
0182: BTFSS 03.2 |
|
|
237 |
0183: GOTO 178 |
|
|
238 |
0184: MOVLW 05 |
|
|
239 |
0185: MOVWF 04 |
|
|
240 |
0186: CLRF 2A |
|
|
241 |
0187: CLRF 29 |
|
|
242 |
0188: MOVF 25,W |
|
|
243 |
0189: MOVWF 28 |
|
|
244 |
018A: MOVF 24,W |
|
|
245 |
018B: MOVWF 27 |
|
|
246 |
018C: MOVLW 03 |
|
|
247 |
018D: MOVWF 2B |
|
|
248 |
018E: GOTO 087 |
|
|
249 |
018F: MOVLW 1F |
|
|
250 |
0190: MOVWF 27 |
|
|
251 |
0191: MOVF 27,W |
|
|
252 |
0192: CALL 004 |
|
|
253 |
0193: INCF 27,F |
|
|
254 |
0194: MOVWF 77 |
|
|
255 |
0195: MOVF 77,W |
|
|
256 |
0196: BTFSS 0C.4 |
|
|
257 |
0197: GOTO 196 |
|
|
258 |
0198: MOVWF 19 |
|
|
259 |
0199: MOVLW 24 |
|
|
260 |
019A: SUBWF 27,W |
|
|
261 |
019B: BTFSS 03.2 |
|
|
262 |
019C: GOTO 191 |
|
|
263 |
.................... } |
|
|
264 |
019D: GOTO 14B |
|
|
265 |
.................... |
|
|
266 |
.................... } |
|
|
267 |
019E: SLEEP |
|
|
268 |
|
|
|
269 |
Configuration Fuses: |
|
|
270 |
Word 1: 3F39 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT |