Rev Author Line No. Line
176 jicha 1 CCS PCM C Compiler, Version 4.058s, 42064 30-III-08 22:54
2  
3 Filename: main.lst
4  
5 ROM used: 591 words (7%)
6 Largest free fragment is 2048
7 RAM used: 18 (5%) at main() level
8 42 (11%) worst case
9 Stack: 2 locations
10  
11 *
12 0000: MOVLW 00
13 0001: MOVWF 0A
14 0002: GOTO 0BC
15 0003: NOP
16 .................... #include "C:\RS\Meric_casu\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 .................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
36 ....................
37 ....................
38 .................... #define mic input(PIN_A4)
39 .................... #define POCET 10
40 .................... #define E1 3034
41 ....................
42 .................... void main()
43 .................... {
44 00BC: CLRF 04
45 00BD: BCF 03.7
46 00BE: MOVLW 1F
47 00BF: ANDWF 03,F
48 00C0: MOVLW 19
49 00C1: BSF 03.5
50 00C2: MOVWF 19
51 00C3: MOVLW A6
52 00C4: MOVWF 18
53 00C5: MOVLW 90
54 00C6: BCF 03.5
55 00C7: MOVWF 18
56 00C8: BSF 03.5
57 00C9: BSF 1F.0
58 00CA: BSF 1F.1
59 00CB: BSF 1F.2
60 00CC: BCF 1F.3
61 00CD: MOVLW 07
62 00CE: MOVWF 1C
63 .................... int16 perioda;
64 .................... int8 i;
65 .................... int32 cas;
66 .................... signed int16 vysl;
67 ....................
68 .................... setup_adc_ports(NO_ANALOGS);
69 *
70 00D2: BSF 03.5
71 00D3: BSF 1F.0
72 00D4: BSF 1F.1
73 00D5: BSF 1F.2
74 00D6: BCF 1F.3
75 .................... setup_adc(ADC_OFF);
76 00D7: BCF 03.5
77 00D8: BCF 1F.0
78 .................... setup_spi(SPI_SS_DISABLED);
79 *
80 00CF: MOVLW FF
81 00D0: BCF 03.5
82 00D1: MOVWF 20
83 *
84 00D9: BCF 14.5
85 00DA: BCF 20.5
86 00DB: MOVF 20,W
87 00DC: BSF 03.5
88 00DD: MOVWF 07
89 00DE: BCF 03.5
90 00DF: BSF 20.4
91 00E0: MOVF 20,W
92 00E1: BSF 03.5
93 00E2: MOVWF 07
94 00E3: BCF 03.5
95 00E4: BCF 20.3
96 00E5: MOVF 20,W
97 00E6: BSF 03.5
98 00E7: MOVWF 07
99 00E8: MOVLW 01
100 00E9: BCF 03.5
101 00EA: MOVWF 14
102 00EB: MOVLW 00
103 00EC: BSF 03.5
104 00ED: MOVWF 14
105 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
106 00EE: MOVF 01,W
107 00EF: ANDLW C7
108 00F0: IORLW 08
109 00F1: MOVWF 01
110 .................... setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
111 00F2: MOVLW 85
112 00F3: BCF 03.5
113 00F4: MOVWF 10
114 .................... setup_timer_2(T2_DISABLED,0,1);
115 00F5: MOVLW 00
116 00F6: MOVWF 78
117 00F7: MOVWF 12
118 00F8: MOVLW 00
119 00F9: BSF 03.5
120 00FA: MOVWF 12
121 .................... setup_comparator(NC_NC_NC_NC);
122 00FB: MOVLW 07
123 00FC: MOVWF 1C
124 00FD: MOVF 05,W
125 00FE: CLRWDT
126 00FF: MOVLW 02
127 0100: MOVWF 77
128 0101: DECFSZ 77,F
129 0102: GOTO 101
130 0103: GOTO 104
131 0104: MOVF 1C,W
132 0105: BCF 03.5
133 0106: BCF 0D.6
134 .................... setup_vref(FALSE);
135 0107: BSF 03.5
136 0108: CLRF 1D
137 .................... output_B(0xFF);
138 0109: CLRF 06
139 010A: MOVLW FF
140 010B: BCF 03.5
141 010C: MOVWF 06
142 ....................
143 .................... while(TRUE)
144 .................... {
145 .................... cas=0;
146 010D: CLRF 27
147 010E: CLRF 26
148 010F: CLRF 25
149 0110: CLRF 24
150 .................... for(i=0;i<POCET;i++)
151 0111: CLRF 23
152 0112: MOVF 23,W
153 0113: SUBLW 09
154 0114: BTFSS 03.0
155 0115: GOTO 154
156 .................... {
157 .................... while(mic);
158 0116: BSF 03.5
159 0117: BSF 05.4
160 0118: BCF 03.5
161 0119: BTFSC 05.4
162 011A: GOTO 116
163 .................... while(!mic);
164 011B: BSF 03.5
165 011C: BSF 05.4
166 011D: BCF 03.5
167 011E: BTFSS 05.4
168 011F: GOTO 11B
169 .................... while(mic)
170 .................... {
171 0120: BSF 03.5
172 0121: BSF 05.4
173 0122: BCF 03.5
174 0123: BTFSS 05.4
175 0124: GOTO 12D
176 .................... set_timer1(0);
177 0125: CLRF 0F
178 0126: CLRF 0E
179 .................... //LED_ON;
180 .................... //delay_us(1400);
181 .................... while(mic);
182 0127: BSF 03.5
183 0128: BSF 05.4
184 0129: BCF 03.5
185 012A: BTFSC 05.4
186 012B: GOTO 127
187 .................... }
188 012C: GOTO 120
189 .................... while(!mic)
190 .................... {
191 012D: BSF 03.5
192 012E: BSF 05.4
193 012F: BCF 03.5
194 0130: BTFSC 05.4
195 0131: GOTO 138
196 .................... //LED_OFF;
197 .................... //delay_us(1400);
198 .................... while(!mic);
199 0132: BSF 03.5
200 0133: BSF 05.4
201 0134: BCF 03.5
202 0135: BTFSS 05.4
203 0136: GOTO 132
204 .................... }
205 0137: GOTO 12D
206 .................... perioda=get_timer1();
207 0138: MOVF 0F,W
208 0139: MOVWF 7A
209 013A: MOVF 0E,W
210 013B: MOVWF 77
211 013C: MOVF 0F,W
212 013D: SUBWF 7A,W
213 013E: BTFSS 03.2
214 013F: GOTO 138
215 0140: MOVF 77,W
216 0141: MOVWF 21
217 0142: MOVF 7A,W
218 0143: MOVWF 22
219 .................... //printf("Perioda %5Lu us.\n\r",perioda);
220 .................... cas+=perioda;
221 0144: MOVF 21,W
222 0145: ADDWF 24,F
223 0146: MOVF 22,W
224 0147: BTFSC 03.0
225 0148: INCFSZ 22,W
226 0149: ADDWF 25,F
227 014A: MOVLW 00
228 014B: BTFSC 03.0
229 014C: MOVLW 01
230 014D: ADDWF 26,F
231 014E: MOVLW 00
232 014F: BTFSC 03.0
233 0150: MOVLW 01
234 0151: ADDWF 27,F
235 .................... }
236 0152: INCF 23,F
237 0153: GOTO 112
238 .................... cas/=i;
239 0154: MOVF 27,W
240 0155: MOVWF 3A
241 0156: MOVF 26,W
242 0157: MOVWF 39
243 0158: MOVF 25,W
244 0159: MOVWF 38
245 015A: MOVF 24,W
246 015B: MOVWF 37
247 015C: CLRF 3E
248 015D: CLRF 3D
249 015E: CLRF 3C
250 015F: MOVF 23,W
251 0160: MOVWF 3B
252 0161: CALL 01B
253 0162: MOVF 7A,W
254 0163: MOVWF 27
255 0164: MOVF 79,W
256 0165: MOVWF 26
257 0166: MOVF 78,W
258 0167: MOVWF 25
259 0168: MOVF 77,W
260 0169: MOVWF 24
261 .................... printf("Perioda %5Lu us.\n\r",cas);
262 016A: CLRF 2A
263 016B: MOVF 2A,W
264 016C: CALL 004
265 016D: INCF 2A,F
266 016E: MOVWF 77
267 016F: MOVF 77,W
268 0170: BTFSS 0C.4
269 0171: GOTO 170
270 0172: MOVWF 19
271 0173: MOVLW 08
272 0174: SUBWF 2A,W
273 0175: BTFSS 03.2
274 0176: GOTO 16B
275 0177: MOVLW 05
276 0178: MOVWF 04
277 0179: MOVF 27,W
278 017A: MOVWF 2E
279 017B: MOVF 26,W
280 017C: MOVWF 2D
281 017D: MOVF 25,W
282 017E: MOVWF 2C
283 017F: MOVF 24,W
284 0180: MOVWF 2B
285 0181: GOTO 05D
286 0182: MOVLW 0C
287 0183: MOVWF 2B
288 0184: MOVF 2B,W
289 0185: CALL 004
290 0186: INCF 2B,F
291 0187: MOVWF 77
292 0188: MOVF 77,W
293 0189: BTFSS 0C.4
294 018A: GOTO 189
295 018B: MOVWF 19
296 018C: MOVLW 12
297 018D: SUBWF 2B,W
298 018E: BTFSS 03.2
299 018F: GOTO 184
300 .................... vysl=cas-E1;
301 0190: MOVLW DA
302 0191: SUBWF 24,W
303 0192: MOVWF 77
304 0193: MOVF 25,W
305 0194: MOVWF 78
306 0195: MOVLW 0B
307 0196: BTFSS 03.0
308 0197: MOVLW 0C
309 0198: SUBWF 78,F
310 0199: MOVF 26,W
311 019A: MOVWF 79
312 019B: MOVLW 00
313 019C: BTFSS 03.0
314 019D: MOVLW 01
315 019E: SUBWF 79,F
316 019F: MOVF 27,W
317 01A0: MOVWF 7A
318 01A1: MOVLW 00
319 01A2: BTFSS 03.0
320 01A3: MOVLW 01
321 01A4: SUBWF 7A,F
322 01A5: MOVF 78,W
323 01A6: MOVWF 29
324 01A7: MOVF 77,W
325 01A8: MOVWF 28
326 .................... if(vysl<-53)output_B(0b10111111);
327 01A9: BTFSS 29.7
328 01AA: GOTO 1BA
329 01AB: MOVF 29,W
330 01AC: SUBLW FF
331 01AD: BTFSS 03.0
332 01AE: GOTO 1BA
333 01AF: BTFSS 03.2
334 01B0: GOTO 1B5
335 01B1: MOVF 28,W
336 01B2: SUBLW CA
337 01B3: BTFSS 03.0
338 01B4: GOTO 1BA
339 01B5: BSF 03.5
340 01B6: CLRF 06
341 01B7: MOVLW BF
342 01B8: BCF 03.5
343 01B9: MOVWF 06
344 .................... if((vysl>-53)&&(vysl<-35))output_B(0b11011111);
345 01BA: BTFSS 29.7
346 01BB: GOTO 1C7
347 01BC: MOVF 29,W
348 01BD: SUBLW FE
349 01BE: BTFSC 03.0
350 01BF: GOTO 1D8
351 01C0: XORLW FF
352 01C1: BTFSS 03.2
353 01C2: GOTO 1C7
354 01C3: MOVF 28,W
355 01C4: SUBLW CB
356 01C5: BTFSC 03.0
357 01C6: GOTO 1D8
358 01C7: BTFSS 29.7
359 01C8: GOTO 1D8
360 01C9: MOVF 29,W
361 01CA: SUBLW FF
362 01CB: BTFSS 03.0
363 01CC: GOTO 1D8
364 01CD: BTFSS 03.2
365 01CE: GOTO 1D3
366 01CF: MOVF 28,W
367 01D0: SUBLW DC
368 01D1: BTFSS 03.0
369 01D2: GOTO 1D8
370 01D3: BSF 03.5
371 01D4: CLRF 06
372 01D5: MOVLW DF
373 01D6: BCF 03.5
374 01D7: MOVWF 06
375 .................... if((vysl>-35)&&(vysl<-17))output_B(0b11101111);
376 01D8: BTFSS 29.7
377 01D9: GOTO 1E5
378 01DA: MOVF 29,W
379 01DB: SUBLW FE
380 01DC: BTFSC 03.0
381 01DD: GOTO 1F6
382 01DE: XORLW FF
383 01DF: BTFSS 03.2
384 01E0: GOTO 1E5
385 01E1: MOVF 28,W
386 01E2: SUBLW DD
387 01E3: BTFSC 03.0
388 01E4: GOTO 1F6
389 01E5: BTFSS 29.7
390 01E6: GOTO 1F6
391 01E7: MOVF 29,W
392 01E8: SUBLW FF
393 01E9: BTFSS 03.0
394 01EA: GOTO 1F6
395 01EB: BTFSS 03.2
396 01EC: GOTO 1F1
397 01ED: MOVF 28,W
398 01EE: SUBLW EE
399 01EF: BTFSS 03.0
400 01F0: GOTO 1F6
401 01F1: BSF 03.5
402 01F2: CLRF 06
403 01F3: MOVLW EF
404 01F4: BCF 03.5
405 01F5: MOVWF 06
406 .................... if((vysl>-17)&&(vysl<17))output_B(0b11110111);
407 01F6: BTFSS 29.7
408 01F7: GOTO 203
409 01F8: MOVF 29,W
410 01F9: SUBLW FE
411 01FA: BTFSC 03.0
412 01FB: GOTO 211
413 01FC: XORLW FF
414 01FD: BTFSS 03.2
415 01FE: GOTO 203
416 01FF: MOVF 28,W
417 0200: SUBLW EF
418 0201: BTFSC 03.0
419 0202: GOTO 211
420 0203: BTFSC 29.7
421 0204: GOTO 20C
422 0205: MOVF 29,F
423 0206: BTFSS 03.2
424 0207: GOTO 211
425 0208: MOVF 28,W
426 0209: SUBLW 10
427 020A: BTFSS 03.0
428 020B: GOTO 211
429 020C: BSF 03.5
430 020D: CLRF 06
431 020E: MOVLW F7
432 020F: BCF 03.5
433 0210: MOVWF 06
434 .................... if((vysl>17)&&(vysl<35))output_B(0b11111011);
435 0211: BTFSC 29.7
436 0212: GOTO 228
437 0213: MOVF 29,F
438 0214: BTFSS 03.2
439 0215: GOTO 21A
440 0216: MOVF 28,W
441 0217: SUBLW 11
442 0218: BTFSC 03.0
443 0219: GOTO 228
444 021A: BTFSC 29.7
445 021B: GOTO 223
446 021C: MOVF 29,F
447 021D: BTFSS 03.2
448 021E: GOTO 228
449 021F: MOVF 28,W
450 0220: SUBLW 22
451 0221: BTFSS 03.0
452 0222: GOTO 228
453 0223: BSF 03.5
454 0224: CLRF 06
455 0225: MOVLW FB
456 0226: BCF 03.5
457 0227: MOVWF 06
458 .................... if((vysl>35)&&(vysl<52))output_B(0b111111101);
459 0228: BTFSC 29.7
460 0229: GOTO 23F
461 022A: MOVF 29,F
462 022B: BTFSS 03.2
463 022C: GOTO 231
464 022D: MOVF 28,W
465 022E: SUBLW 23
466 022F: BTFSC 03.0
467 0230: GOTO 23F
468 0231: BTFSC 29.7
469 0232: GOTO 23A
470 0233: MOVF 29,F
471 0234: BTFSS 03.2
472 0235: GOTO 23F
473 0236: MOVF 28,W
474 0237: SUBLW 33
475 0238: BTFSS 03.0
476 0239: GOTO 23F
477 023A: BSF 03.5
478 023B: CLRF 06
479 023C: MOVLW FD
480 023D: BCF 03.5
481 023E: MOVWF 06
482 .................... if(vysl>52)output_B(0b111111110);
483 023F: BTFSC 29.7
484 0240: GOTO 24D
485 0241: MOVF 29,F
486 0242: BTFSS 03.2
487 0243: GOTO 248
488 0244: MOVF 28,W
489 0245: SUBLW 34
490 0246: BTFSC 03.0
491 0247: GOTO 24D
492 0248: BSF 03.5
493 0249: CLRF 06
494 024A: MOVLW FE
495 024B: BCF 03.5
496 024C: MOVWF 06
497 .................... }
498 024D: GOTO 10D
499 .................... }
500 024E: SLEEP
501  
502 Configuration Fuses:
503 Word 1: 3F39 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT