Rev Author Line No. Line
503 kaklik 1 CCS PCM C Compiler, Version 3.221, 27853 27-IV-05 14:16
2  
3 Filename: D:\KAKLIK\programy\PIC_C\roboti\merkur\PIC16F88\turn_R\tank.LST
4  
5 ROM used: 1587 words (39%)
6 Largest free fragment is 2048
7 RAM used: 87 (50%) at main() level
8 98 (56%) worst case
9 Stack: 4 worst case (3 in main + 1 for interrupts)
10  
11 *
12 0000: MOVLW 00
13 0001: MOVWF 0A
14 0002: GOTO 472
15 0003: NOP
16 0004: MOVWF 7F
17 0005: SWAPF 03,W
18 0006: CLRF 03
19 0007: MOVWF 21
20 0008: MOVF 7F,W
21 0009: MOVWF 20
22 000A: MOVF 0A,W
23 000B: MOVWF 28
24 000C: CLRF 0A
25 000D: SWAPF 20,F
26 000E: MOVF 04,W
27 000F: MOVWF 22
28 0010: MOVF 77,W
29 0011: MOVWF 23
30 0012: MOVF 78,W
31 0013: MOVWF 24
32 0014: MOVF 79,W
33 0015: MOVWF 25
34 0016: MOVF 7A,W
35 0017: MOVWF 26
36 0018: MOVF 7B,W
37 0019: MOVWF 27
38 001A: BCF 03.7
39 001B: BCF 03.5
40 001C: MOVLW 8C
41 001D: MOVWF 04
42 001E: BTFSS 00.1
43 001F: GOTO 022
44 0020: BTFSC 0C.1
45 0021: GOTO 035
46 0022: MOVF 22,W
47 0023: MOVWF 04
48 0024: MOVF 23,W
49 0025: MOVWF 77
50 0026: MOVF 24,W
51 0027: MOVWF 78
52 0028: MOVF 25,W
53 0029: MOVWF 79
54 002A: MOVF 26,W
55 002B: MOVWF 7A
56 002C: MOVF 27,W
57 002D: MOVWF 7B
58 002E: MOVF 28,W
59 002F: MOVWF 0A
60 0030: SWAPF 21,W
61 0031: MOVWF 03
62 0032: SWAPF 7F,F
63 0033: SWAPF 7F,W
64 0034: RETFIE
65 0035: BCF 0A.3
66 0036: GOTO 037
67 .................... #include "tank.h"
68 .................... #include <16F88.h>
69 .................... //////// Standard Header file for the PIC16F88 device ////////////////
70 .................... #device PIC16F88
71 .................... #list
72 ....................
73 .................... #device adc=8
74 .................... #fuses NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, NOFCMEN, NOIESO
75 .................... #use delay(clock=4000000)
76 *
77 0047: MOVLW 12
78 0048: BSF 03.5
79 0049: SUBWF 22,F
80 004A: BTFSS 03.0
81 004B: GOTO 05A
82 004C: MOVLW A2
83 004D: MOVWF 04
84 004E: MOVLW FC
85 004F: ANDWF 00,F
86 0050: BCF 03.0
87 0051: RRF 00,F
88 0052: RRF 00,F
89 0053: MOVF 00,W
90 0054: BTFSC 03.2
91 0055: GOTO 05A
92 0056: GOTO 058
93 0057: NOP
94 0058: DECFSZ 00,F
95 0059: GOTO 057
96 005A: BCF 03.5
97 005B: RETLW 00
98 *
99 0088: MOVLW 74
100 0089: MOVWF 04
101 008A: MOVF 00,W
102 008B: BTFSC 03.2
103 008C: GOTO 09C
104 008D: MOVLW 01
105 008E: MOVWF 78
106 008F: CLRF 77
107 0090: DECFSZ 77,F
108 0091: GOTO 090
109 0092: DECFSZ 78,F
110 0093: GOTO 08F
111 0094: MOVLW 4A
112 0095: MOVWF 77
113 0096: DECFSZ 77,F
114 0097: GOTO 096
115 0098: NOP
116 0099: NOP
117 009A: DECFSZ 00,F
118 009B: GOTO 08D
119 009C: RETLW 00
120 ....................
121 ....................
122 ....................
123 .................... #define DEBUG
124 ....................
125 .................... #define TXo PIN_A3 // To the transmitter modulator
126 .................... #include "AX25.c" // podprogram pro prenos telemetrie
127 .................... #list
128 ....................
129 ....................
130 .................... unsigned int8 sensors; // pomocna promenna pro cteni cidel na caru
131 .................... unsigned int8 line; // na ktere strane byla detekovana cara
132 .................... unsigned int8 speed; // rychlost zataceni
133 .................... unsigned int8 rovinka; // pocitadlo pro zjisteni rovneho useku
134 .................... unsigned int8 last; // kde byla cara, kdyz byly minule cidla mimo
135 .................... unsigned int8 movement; // obsahuje aktualni smer zataceni
136 .................... unsigned int8 dira; // pocita dobu po kterou je ztracena cara
137 ....................
138 .................... // Konstanty pro dynamiku pohybu
139 .................... #define T_DIRA 120 // po jakem case zataceni se detekuje dira
140 .................... #define INC_SPEED 1 // prirustek rychlosti v jednom kroku
141 .................... #define FW_POMALU 230 // trochu mimo caru vnitrni pas
142 .................... #define FW_ZATACKA 240 // rychlost vnejsiho kola pri zataceni
143 .................... #define FW_STREDNE 240 // trochu mimo caru vnejsi pas
144 .................... #define COUVANI 750 // couvnuti zpet na caru, po detekci diry
145 .................... #define PRES_DIRU 300
146 .................... #define MAX_ROVINKA (255-FW_STREDNE)
147 .................... #define TRESHOLD 6 // rozhodovaci uroven komparatoru, 0xF = 0.75*Vdd
148 .................... #define BUMPER_TRESHOLD 128
149 .................... #define CIK_CAK 30000
150 .................... #define T_CIHLA 50 // perioda detekce cihly
151 ....................
152 .................... //motory //Napred vypnout potom zapnout!
153 .................... #define FR output_low(PIN_B5); output_high(PIN_B4) // Vpred
154 .................... #define FL output_low(PIN_B7); output_high(PIN_B6)
155 .................... #define BR output_low(PIN_B4); output_high(PIN_B5) // Vzad
156 .................... #define BL output_low(PIN_B6); output_high(PIN_B7)
157 .................... #define STOPR output_low(PIN_B4);output_low(PIN_B5) // Zastav
158 .................... #define STOPL output_low(PIN_B6);output_low(PIN_B7)
159 ....................
160 .................... #define L 0b10 // left
161 .................... #define R 0b01 // right
162 .................... #define S 0b11 // straight
163 ....................
164 .................... //cidla
165 .................... #define RSENSOR C2OUT // Senzory na caru
166 .................... #define LSENSOR C1OUT
167 .................... #define BUMPER PIN_A4 // Senzor na cihlu
168 ....................
169 .................... #define DIAG_SERVO PIN_B3 // Propojka pro diagnosticky mod
170 .................... #define DIAG_SENSORS PIN_B2 // Propojka pro diagnosticky mod
171 ....................
172 .................... #DEFINE SOUND_HI PIN_A6 // komplementarni vystupy pro piezo pipak
173 .................... #DEFINE SOUND_LO PIN_A7
174 ....................
175 .................... char AXstring[40]; // Buffer pro prenos telemetrie
176 ....................
177 .................... // makro pro PWM
178 .................... #define GO(motor, direction, power) if(get_timer0()<=power) \
179 .................... {direction##motor;} else {stop##motor;}
180 ....................
181 .................... #int_TIMER2
182 .................... void TIMER2_isr()
183 .................... {
184 .................... if (speed<255) speed+=INC_SPEED;
185 *
186 0037: INCFSZ 42,W
187 0038: GOTO 03A
188 0039: GOTO 03C
189 003A: MOVLW 01
190 003B: ADDWF 42,F
191 .................... if (rovinka<MAX_ROVINKA) rovinka++;
192 003C: MOVF 43,W
193 003D: SUBLW 0E
194 003E: BTFSC 03.0
195 003F: INCF 43,F
196 .................... if (dira<=T_DIRA) dira++;
197 0040: MOVF 46,W
198 0041: SUBLW 78
199 0042: BTFSC 03.0
200 0043: INCF 46,F
201 .................... }
202 .................... // Primitivni Pipani
203 0044: BCF 0C.1
204 0045: BCF 0A.3
205 0046: GOTO 022
206 .................... void beep(unsigned int16 period, unsigned int16 length)
207 .................... {
208 .................... unsigned int16 nn;
209 ....................
210 .................... for(nn=length; nn>0; nn--)
211 *
212 005C: MOVF 7D,W
213 005D: BSF 03.5
214 005E: MOVWF 21
215 005F: MOVF 7C,W
216 0060: MOVWF 20
217 0061: MOVF 20,F
218 0062: BTFSS 03.2
219 0063: GOTO 067
220 0064: MOVF 21,F
221 0065: BTFSC 03.2
222 0066: GOTO 086
223 .................... {
224 .................... output_high(SOUND_HI);output_low(SOUND_LO);
225 0067: BCF 05.6
226 0068: BCF 03.5
227 0069: BSF 05.6
228 006A: BSF 03.5
229 006B: BCF 05.7
230 006C: BCF 03.5
231 006D: BCF 05.7
232 .................... delay_us(period);
233 006E: MOVF 74,W
234 006F: BSF 03.5
235 0070: MOVWF 22
236 0071: BCF 03.5
237 0072: CALL 047
238 .................... output_high(SOUND_LO);output_low(SOUND_HI);
239 0073: BSF 03.5
240 0074: BCF 05.7
241 0075: BCF 03.5
242 0076: BSF 05.7
243 0077: BSF 03.5
244 0078: BCF 05.6
245 0079: BCF 03.5
246 007A: BCF 05.6
247 .................... delay_us(period);
248 007B: MOVF 74,W
249 007C: BSF 03.5
250 007D: MOVWF 22
251 007E: BCF 03.5
252 007F: CALL 047
253 .................... }
254 0080: BSF 03.5
255 0081: MOVF 20,W
256 0082: BTFSC 03.2
257 0083: DECF 21,F
258 0084: DECF 20,F
259 0085: GOTO 061
260 .................... }
261 0086: BCF 03.5
262 0087: RETLW 00
263 .................... /******************************************************************************/
264 .................... void diagnostika()
265 .................... {
266 .................... unsigned int16 n;
267 ....................
268 .................... while (input(DIAG_SERVO)) // Propojka, ktera spousti diagnostiku
269 .................... {
270 *
271 009D: BSF 03.5
272 009E: BSF 06.3
273 009F: BCF 03.5
274 00A0: BTFSS 06.3
275 00A1: GOTO 1C8
276 .................... for (n=500; n<800; n+=100)
277 00A2: MOVLW 01
278 00A3: MOVWF 72
279 00A4: MOVLW F4
280 00A5: MOVWF 71
281 00A6: MOVF 72,W
282 00A7: SUBLW 03
283 00A8: BTFSS 03.0
284 00A9: GOTO 0BE
285 00AA: BTFSS 03.2
286 00AB: GOTO 0B0
287 00AC: MOVF 71,W
288 00AD: SUBLW 1F
289 00AE: BTFSS 03.0
290 00AF: GOTO 0BE
291 .................... {
292 .................... beep(n,n); //beep UP
293 00B0: MOVF 72,W
294 00B1: MOVWF 75
295 00B2: MOVF 71,W
296 00B3: MOVWF 74
297 00B4: MOVF 72,W
298 00B5: MOVWF 7D
299 00B6: MOVF 71,W
300 00B7: MOVWF 7C
301 00B8: CALL 05C
302 .................... };
303 00B9: MOVLW 64
304 00BA: ADDWF 71,F
305 00BB: BTFSC 03.0
306 00BC: INCF 72,F
307 00BD: GOTO 0A6
308 .................... Delay_ms(1000);
309 00BE: MOVLW 04
310 00BF: MOVWF 73
311 00C0: MOVLW FA
312 00C1: MOVWF 74
313 00C2: CALL 088
314 00C3: DECFSZ 73,F
315 00C4: GOTO 0C0
316 .................... //zastav vse
317 .................... STOPL; STOPR;
318 00C5: BSF 03.5
319 00C6: BCF 06.6
320 00C7: BCF 03.5
321 00C8: BCF 06.6
322 00C9: BSF 03.5
323 00CA: BCF 06.7
324 00CB: BCF 03.5
325 00CC: BCF 06.7
326 00CD: BSF 03.5
327 00CE: BCF 06.4
328 00CF: BCF 03.5
329 00D0: BCF 06.4
330 00D1: BSF 03.5
331 00D2: BCF 06.5
332 00D3: BCF 03.5
333 00D4: BCF 06.5
334 .................... //pravy pas
335 .................... FR; Delay_ms(1000); STOPR; Delay_ms(1000);
336 00D5: BSF 03.5
337 00D6: BCF 06.5
338 00D7: BCF 03.5
339 00D8: BCF 06.5
340 00D9: BSF 03.5
341 00DA: BCF 06.4
342 00DB: BCF 03.5
343 00DC: BSF 06.4
344 00DD: MOVLW 04
345 00DE: MOVWF 73
346 00DF: MOVLW FA
347 00E0: MOVWF 74
348 00E1: CALL 088
349 00E2: DECFSZ 73,F
350 00E3: GOTO 0DF
351 00E4: BSF 03.5
352 00E5: BCF 06.4
353 00E6: BCF 03.5
354 00E7: BCF 06.4
355 00E8: BSF 03.5
356 00E9: BCF 06.5
357 00EA: BCF 03.5
358 00EB: BCF 06.5
359 00EC: MOVLW 04
360 00ED: MOVWF 73
361 00EE: MOVLW FA
362 00EF: MOVWF 74
363 00F0: CALL 088
364 00F1: DECFSZ 73,F
365 00F2: GOTO 0EE
366 .................... BR; Delay_ms(1000); STOPR; Delay_ms(1000);
367 00F3: BSF 03.5
368 00F4: BCF 06.4
369 00F5: BCF 03.5
370 00F6: BCF 06.4
371 00F7: BSF 03.5
372 00F8: BCF 06.5
373 00F9: BCF 03.5
374 00FA: BSF 06.5
375 00FB: MOVLW 04
376 00FC: MOVWF 73
377 00FD: MOVLW FA
378 00FE: MOVWF 74
379 00FF: CALL 088
380 0100: DECFSZ 73,F
381 0101: GOTO 0FD
382 0102: BSF 03.5
383 0103: BCF 06.4
384 0104: BCF 03.5
385 0105: BCF 06.4
386 0106: BSF 03.5
387 0107: BCF 06.5
388 0108: BCF 03.5
389 0109: BCF 06.5
390 010A: MOVLW 04
391 010B: MOVWF 73
392 010C: MOVLW FA
393 010D: MOVWF 74
394 010E: CALL 088
395 010F: DECFSZ 73,F
396 0110: GOTO 10C
397 .................... Beep(880,100); Delay_ms(1000);
398 0111: MOVLW 03
399 0112: MOVWF 75
400 0113: MOVLW 70
401 0114: MOVWF 74
402 0115: CLRF 7D
403 0116: MOVLW 64
404 0117: MOVWF 7C
405 0118: CALL 05C
406 0119: MOVLW 04
407 011A: MOVWF 73
408 011B: MOVLW FA
409 011C: MOVWF 74
410 011D: CALL 088
411 011E: DECFSZ 73,F
412 011F: GOTO 11B
413 .................... //levy pas
414 .................... FL; Delay_ms(1000); STOPL; Delay_ms(1000);
415 0120: BSF 03.5
416 0121: BCF 06.7
417 0122: BCF 03.5
418 0123: BCF 06.7
419 0124: BSF 03.5
420 0125: BCF 06.6
421 0126: BCF 03.5
422 0127: BSF 06.6
423 0128: MOVLW 04
424 0129: MOVWF 73
425 012A: MOVLW FA
426 012B: MOVWF 74
427 012C: CALL 088
428 012D: DECFSZ 73,F
429 012E: GOTO 12A
430 012F: BSF 03.5
431 0130: BCF 06.6
432 0131: BCF 03.5
433 0132: BCF 06.6
434 0133: BSF 03.5
435 0134: BCF 06.7
436 0135: BCF 03.5
437 0136: BCF 06.7
438 0137: MOVLW 04
439 0138: MOVWF 73
440 0139: MOVLW FA
441 013A: MOVWF 74
442 013B: CALL 088
443 013C: DECFSZ 73,F
444 013D: GOTO 139
445 .................... BL; Delay_ms(1000); STOPL; Delay_ms(1000);
446 013E: BSF 03.5
447 013F: BCF 06.6
448 0140: BCF 03.5
449 0141: BCF 06.6
450 0142: BSF 03.5
451 0143: BCF 06.7
452 0144: BCF 03.5
453 0145: BSF 06.7
454 0146: MOVLW 04
455 0147: MOVWF 73
456 0148: MOVLW FA
457 0149: MOVWF 74
458 014A: CALL 088
459 014B: DECFSZ 73,F
460 014C: GOTO 148
461 014D: BSF 03.5
462 014E: BCF 06.6
463 014F: BCF 03.5
464 0150: BCF 06.6
465 0151: BSF 03.5
466 0152: BCF 06.7
467 0153: BCF 03.5
468 0154: BCF 06.7
469 0155: MOVLW 04
470 0156: MOVWF 73
471 0157: MOVLW FA
472 0158: MOVWF 74
473 0159: CALL 088
474 015A: DECFSZ 73,F
475 015B: GOTO 157
476 .................... Beep(880,100); Delay_ms(1000);
477 015C: MOVLW 03
478 015D: MOVWF 75
479 015E: MOVLW 70
480 015F: MOVWF 74
481 0160: CLRF 7D
482 0161: MOVLW 64
483 0162: MOVWF 7C
484 0163: CALL 05C
485 0164: MOVLW 04
486 0165: MOVWF 73
487 0166: MOVLW FA
488 0167: MOVWF 74
489 0168: CALL 088
490 0169: DECFSZ 73,F
491 016A: GOTO 166
492 .................... //oba pasy
493 .................... FL; FR; Delay_ms(1000); STOPL; STOPR; Delay_ms(1000);
494 016B: BSF 03.5
495 016C: BCF 06.7
496 016D: BCF 03.5
497 016E: BCF 06.7
498 016F: BSF 03.5
499 0170: BCF 06.6
500 0171: BCF 03.5
501 0172: BSF 06.6
502 0173: BSF 03.5
503 0174: BCF 06.5
504 0175: BCF 03.5
505 0176: BCF 06.5
506 0177: BSF 03.5
507 0178: BCF 06.4
508 0179: BCF 03.5
509 017A: BSF 06.4
510 017B: MOVLW 04
511 017C: MOVWF 73
512 017D: MOVLW FA
513 017E: MOVWF 74
514 017F: CALL 088
515 0180: DECFSZ 73,F
516 0181: GOTO 17D
517 0182: BSF 03.5
518 0183: BCF 06.6
519 0184: BCF 03.5
520 0185: BCF 06.6
521 0186: BSF 03.5
522 0187: BCF 06.7
523 0188: BCF 03.5
524 0189: BCF 06.7
525 018A: BSF 03.5
526 018B: BCF 06.4
527 018C: BCF 03.5
528 018D: BCF 06.4
529 018E: BSF 03.5
530 018F: BCF 06.5
531 0190: BCF 03.5
532 0191: BCF 06.5
533 0192: MOVLW 04
534 0193: MOVWF 73
535 0194: MOVLW FA
536 0195: MOVWF 74
537 0196: CALL 088
538 0197: DECFSZ 73,F
539 0198: GOTO 194
540 .................... BL; BR; Delay_ms(1000); STOPL; STOPR; Delay_ms(1000);
541 0199: BSF 03.5
542 019A: BCF 06.6
543 019B: BCF 03.5
544 019C: BCF 06.6
545 019D: BSF 03.5
546 019E: BCF 06.7
547 019F: BCF 03.5
548 01A0: BSF 06.7
549 01A1: BSF 03.5
550 01A2: BCF 06.4
551 01A3: BCF 03.5
552 01A4: BCF 06.4
553 01A5: BSF 03.5
554 01A6: BCF 06.5
555 01A7: BCF 03.5
556 01A8: BSF 06.5
557 01A9: MOVLW 04
558 01AA: MOVWF 73
559 01AB: MOVLW FA
560 01AC: MOVWF 74
561 01AD: CALL 088
562 01AE: DECFSZ 73,F
563 01AF: GOTO 1AB
564 01B0: BSF 03.5
565 01B1: BCF 06.6
566 01B2: BCF 03.5
567 01B3: BCF 06.6
568 01B4: BSF 03.5
569 01B5: BCF 06.7
570 01B6: BCF 03.5
571 01B7: BCF 06.7
572 01B8: BSF 03.5
573 01B9: BCF 06.4
574 01BA: BCF 03.5
575 01BB: BCF 06.4
576 01BC: BSF 03.5
577 01BD: BCF 06.5
578 01BE: BCF 03.5
579 01BF: BCF 06.5
580 01C0: MOVLW 04
581 01C1: MOVWF 73
582 01C2: MOVLW FA
583 01C3: MOVWF 74
584 01C4: CALL 088
585 01C5: DECFSZ 73,F
586 01C6: GOTO 1C2
587 .................... };
588 01C7: GOTO 09D
589 .................... while (input(DIAG_SENSORS)) // spusteni diagnostiky cidel
590 .................... {
591 01C8: BSF 03.5
592 01C9: BSF 06.2
593 01CA: BCF 03.5
594 01CB: BTFSS 06.2
595 01CC: GOTO 1FB
596 .................... if (RSENSOR) beep(900,500);
597 01CD: BSF 03.5
598 01CE: BTFSS 1C.7
599 01CF: GOTO 1DB
600 01D0: MOVLW 03
601 01D1: MOVWF 75
602 01D2: MOVLW 84
603 01D3: MOVWF 74
604 01D4: MOVLW 01
605 01D5: MOVWF 7D
606 01D6: MOVLW F4
607 01D7: MOVWF 7C
608 01D8: BCF 03.5
609 01D9: CALL 05C
610 01DA: BSF 03.5
611 .................... if (LSENSOR) beep(800,500);
612 01DB: BTFSS 1C.6
613 01DC: GOTO 1E8
614 01DD: MOVLW 03
615 01DE: MOVWF 75
616 01DF: MOVLW 20
617 01E0: MOVWF 74
618 01E1: MOVLW 01
619 01E2: MOVWF 7D
620 01E3: MOVLW F4
621 01E4: MOVWF 7C
622 01E5: BCF 03.5
623 01E6: CALL 05C
624 01E7: BSF 03.5
625 .................... if ((read_adc(ADC_READ_ONLY)<BUMPER_TRESHOLD)) beep(1000,500);
626 01E8: BCF 03.5
627 01E9: BTFSS 1F.2
628 01EA: GOTO 1ED
629 01EB: BSF 03.5
630 01EC: GOTO 1E8
631 01ED: MOVF 1E,W
632 01EE: SUBLW 7F
633 01EF: BTFSS 03.0
634 01F0: GOTO 1FA
635 01F1: MOVLW 03
636 01F2: MOVWF 75
637 01F3: MOVLW E8
638 01F4: MOVWF 74
639 01F5: MOVLW 01
640 01F6: MOVWF 7D
641 01F7: MOVLW F4
642 01F8: MOVWF 7C
643 01F9: CALL 05C
644 .................... };
645 01FA: GOTO 1C8
646 .................... }
647 01FB: BCF 0A.3
648 01FC: GOTO 520 (RETURN)
649 .................... ///////////////////////////////////////////////////////////////////////////////
650 .................... void cikcak()
651 .................... {
652 .................... unsigned int16 n;
653 .................... sem1:
654 .................... n=CIK_CAK;
655 01FD: MOVLW 75
656 01FE: MOVWF 75
657 01FF: MOVLW 30
658 0200: MOVWF 74
659 .................... while (0==RSENSOR||LSENSOR) // zkontroluj caru
660 .................... {
661 0201: MOVLW 00
662 0202: BSF 03.5
663 0203: BTFSC 1C.7
664 0204: MOVLW 01
665 0205: XORLW 00
666 0206: BTFSC 03.2
667 0207: GOTO 20A
668 0208: BTFSS 1C.6
669 0209: GOTO 264
670 .................... if (n==CIK_CAK) // zmen smer zataceni
671 020A: MOVF 74,W
672 020B: SUBLW 30
673 020C: BTFSS 03.2
674 020D: GOTO 25E
675 020E: MOVF 75,W
676 020F: SUBLW 75
677 0210: BTFSS 03.2
678 0211: GOTO 25E
679 .................... {
680 .................... n=0;
681 0212: CLRF 75
682 0213: CLRF 74
683 .................... switch(movement)
684 .................... {
685 0214: BCF 03.5
686 0215: MOVF 45,W
687 0216: XORLW 02
688 0217: BTFSC 03.2
689 0218: GOTO 220
690 0219: XORLW 03
691 021A: BTFSC 03.2
692 021B: GOTO 233
693 021C: XORLW 02
694 021D: BTFSC 03.2
695 021E: GOTO 246
696 021F: GOTO 25D
697 .................... case L:
698 .................... FL;BR;
699 0220: BSF 03.5
700 0221: BCF 06.7
701 0222: BCF 03.5
702 0223: BCF 06.7
703 0224: BSF 03.5
704 0225: BCF 06.6
705 0226: BCF 03.5
706 0227: BSF 06.6
707 0228: BSF 03.5
708 0229: BCF 06.4
709 022A: BCF 03.5
710 022B: BCF 06.4
711 022C: BSF 03.5
712 022D: BCF 06.5
713 022E: BCF 03.5
714 022F: BSF 06.5
715 .................... movement=R;
716 0230: MOVLW 01
717 0231: MOVWF 45
718 .................... break;
719 0232: GOTO 25D
720 .................... case R:
721 .................... FR;BL;
722 0233: BSF 03.5
723 0234: BCF 06.5
724 0235: BCF 03.5
725 0236: BCF 06.5
726 0237: BSF 03.5
727 0238: BCF 06.4
728 0239: BCF 03.5
729 023A: BSF 06.4
730 023B: BSF 03.5
731 023C: BCF 06.6
732 023D: BCF 03.5
733 023E: BCF 06.6
734 023F: BSF 03.5
735 0240: BCF 06.7
736 0241: BCF 03.5
737 0242: BSF 06.7
738 .................... movement=L;
739 0243: MOVLW 02
740 0244: MOVWF 45
741 .................... break;
742 0245: GOTO 25D
743 .................... case S:
744 .................... FL;BR;
745 0246: BSF 03.5
746 0247: BCF 06.7
747 0248: BCF 03.5
748 0249: BCF 06.7
749 024A: BSF 03.5
750 024B: BCF 06.6
751 024C: BCF 03.5
752 024D: BSF 06.6
753 024E: BSF 03.5
754 024F: BCF 06.4
755 0250: BCF 03.5
756 0251: BCF 06.4
757 0252: BSF 03.5
758 0253: BCF 06.5
759 0254: BCF 03.5
760 0255: BSF 06.5
761 .................... movement=R;
762 0256: MOVLW 01
763 0257: MOVWF 45
764 .................... n=CIK_CAK/2;
765 0258: MOVLW 3A
766 0259: MOVWF 75
767 025A: MOVLW 98
768 025B: MOVWF 74
769 .................... break;
770 025C: GOTO 25D
771 025D: BSF 03.5
772 .................... }
773 .................... }
774 .................... n++;
775 025E: INCF 74,F
776 025F: BTFSC 03.2
777 0260: INCF 75,F
778 .................... }
779 0261: BCF 03.5
780 0262: GOTO 201
781 0263: BSF 03.5
782 .................... STOPL;STOPR;
783 0264: BCF 06.6
784 0265: BCF 03.5
785 0266: BCF 06.6
786 0267: BSF 03.5
787 0268: BCF 06.7
788 0269: BCF 03.5
789 026A: BCF 06.7
790 026B: BSF 03.5
791 026C: BCF 06.4
792 026D: BCF 03.5
793 026E: BCF 06.4
794 026F: BSF 03.5
795 0270: BCF 06.5
796 0271: BCF 03.5
797 0272: BCF 06.5
798 .................... line = RSENSOR; // cteni senzoru na caru
799 0273: CLRF 41
800 0274: BSF 03.5
801 0275: BTFSS 1C.7
802 0276: GOTO 27A
803 0277: BCF 03.5
804 0278: INCF 41,F
805 0279: BSF 03.5
806 .................... line |= LSENSOR << 1;
807 027A: MOVLW 00
808 027B: BTFSC 1C.6
809 027C: MOVLW 01
810 027D: MOVWF 77
811 027E: BCF 03.0
812 027F: RLF 77,F
813 0280: MOVF 77,W
814 0281: BCF 03.5
815 0282: IORWF 41,F
816 .................... if (line==0) goto sem1;
817 0283: MOVF 41,F
818 0284: BTFSC 03.2
819 0285: GOTO 1FD
820 .................... // nasli jsme caru
821 .................... line=S;
822 0286: MOVLW 03
823 0287: MOVWF 41
824 .................... }
825 0288: RETLW 00
826 .................... ///////////////////////////////////////////////////////////////////////////////
827 .................... void objizdka() // objede cihlu
828 .................... {
829 .................... unsigned int16 n;
830 ....................
831 .................... BL;BR;Delay_ms(150);
832 0289: BSF 03.5
833 028A: BCF 06.6
834 028B: BCF 03.5
835 028C: BCF 06.6
836 028D: BSF 03.5
837 028E: BCF 06.7
838 028F: BCF 03.5
839 0290: BSF 06.7
840 0291: BSF 03.5
841 0292: BCF 06.4
842 0293: BCF 03.5
843 0294: BCF 06.4
844 0295: BSF 03.5
845 0296: BCF 06.5
846 0297: BCF 03.5
847 0298: BSF 06.5
848 0299: MOVLW 96
849 029A: MOVWF 74
850 029B: CALL 088
851 .................... STOPR;STOPL;
852 029C: BSF 03.5
853 029D: BCF 06.4
854 029E: BCF 03.5
855 029F: BCF 06.4
856 02A0: BSF 03.5
857 02A1: BCF 06.5
858 02A2: BCF 03.5
859 02A3: BCF 06.5
860 02A4: BSF 03.5
861 02A5: BCF 06.6
862 02A6: BCF 03.5
863 02A7: BCF 06.6
864 02A8: BSF 03.5
865 02A9: BCF 06.7
866 02AA: BCF 03.5
867 02AB: BCF 06.7
868 .................... beep(900,1000);
869 02AC: MOVLW 03
870 02AD: MOVWF 75
871 02AE: MOVLW 84
872 02AF: MOVWF 74
873 02B0: MOVLW 03
874 02B1: MOVWF 7D
875 02B2: MOVLW E8
876 02B3: MOVWF 7C
877 02B4: CALL 05C
878 .................... // movement=S;
879 .................... // cikcak();
880 ....................
881 .................... BR; FL; Delay_ms(270); // otoc se 70° do prava
882 02B5: BSF 03.5
883 02B6: BCF 06.4
884 02B7: BCF 03.5
885 02B8: BCF 06.4
886 02B9: BSF 03.5
887 02BA: BCF 06.5
888 02BB: BCF 03.5
889 02BC: BSF 06.5
890 02BD: BSF 03.5
891 02BE: BCF 06.7
892 02BF: BCF 03.5
893 02C0: BCF 06.7
894 02C1: BSF 03.5
895 02C2: BCF 06.6
896 02C3: BCF 03.5
897 02C4: BSF 06.6
898 02C5: MOVLW 02
899 02C6: MOVWF 73
900 02C7: MOVLW 87
901 02C8: MOVWF 74
902 02C9: CALL 088
903 02CA: DECFSZ 73,F
904 02CB: GOTO 2C7
905 ....................
906 .................... FR; FL; Delay_ms(500); // popojed rovne
907 02CC: BSF 03.5
908 02CD: BCF 06.5
909 02CE: BCF 03.5
910 02CF: BCF 06.5
911 02D0: BSF 03.5
912 02D1: BCF 06.4
913 02D2: BCF 03.5
914 02D3: BSF 06.4
915 02D4: BSF 03.5
916 02D5: BCF 06.7
917 02D6: BCF 03.5
918 02D7: BCF 06.7
919 02D8: BSF 03.5
920 02D9: BCF 06.6
921 02DA: BCF 03.5
922 02DB: BSF 06.6
923 02DC: MOVLW 02
924 02DD: MOVWF 73
925 02DE: MOVLW FA
926 02DF: MOVWF 74
927 02E0: CALL 088
928 02E1: DECFSZ 73,F
929 02E2: GOTO 2DE
930 ....................
931 .................... BL; Delay_ms(30); // otoc se 90° do leva
932 02E3: BSF 03.5
933 02E4: BCF 06.6
934 02E5: BCF 03.5
935 02E6: BCF 06.6
936 02E7: BSF 03.5
937 02E8: BCF 06.7
938 02E9: BCF 03.5
939 02EA: BSF 06.7
940 02EB: MOVLW 1E
941 02EC: MOVWF 74
942 02ED: CALL 088
943 .................... STOPL; FR; Delay_ms(500);
944 02EE: BSF 03.5
945 02EF: BCF 06.6
946 02F0: BCF 03.5
947 02F1: BCF 06.6
948 02F2: BSF 03.5
949 02F3: BCF 06.7
950 02F4: BCF 03.5
951 02F5: BCF 06.7
952 02F6: BSF 03.5
953 02F7: BCF 06.5
954 02F8: BCF 03.5
955 02F9: BCF 06.5
956 02FA: BSF 03.5
957 02FB: BCF 06.4
958 02FC: BCF 03.5
959 02FD: BSF 06.4
960 02FE: MOVLW 02
961 02FF: MOVWF 73
962 0300: MOVLW FA
963 0301: MOVWF 74
964 0302: CALL 088
965 0303: DECFSZ 73,F
966 0304: GOTO 300
967 ....................
968 .................... FR; FL; Delay_ms(100); // popojed rovne na slepo
969 0305: BSF 03.5
970 0306: BCF 06.5
971 0307: BCF 03.5
972 0308: BCF 06.5
973 0309: BSF 03.5
974 030A: BCF 06.4
975 030B: BCF 03.5
976 030C: BSF 06.4
977 030D: BSF 03.5
978 030E: BCF 06.7
979 030F: BCF 03.5
980 0310: BCF 06.7
981 0311: BSF 03.5
982 0312: BCF 06.6
983 0313: BCF 03.5
984 0314: BSF 06.6
985 0315: MOVLW 64
986 0316: MOVWF 74
987 0317: CALL 088
988 .................... for(n=40000;n>0;n--) // popojed rovne ale kontroluj caru
989 0318: MOVLW 9C
990 0319: MOVWF 72
991 031A: MOVLW 40
992 031B: MOVWF 71
993 031C: MOVF 71,F
994 031D: BTFSS 03.2
995 031E: GOTO 322
996 031F: MOVF 72,F
997 0320: BTFSC 03.2
998 0321: GOTO 33E
999 .................... {
1000 .................... line = RSENSOR; // cteni senzoru na caru
1001 0322: CLRF 41
1002 0323: BSF 03.5
1003 0324: BTFSS 1C.7
1004 0325: GOTO 329
1005 0326: BCF 03.5
1006 0327: INCF 41,F
1007 0328: BSF 03.5
1008 .................... line |= LSENSOR << 1;
1009 0329: MOVLW 00
1010 032A: BTFSC 1C.6
1011 032B: MOVLW 01
1012 032C: MOVWF 77
1013 032D: BCF 03.0
1014 032E: RLF 77,F
1015 032F: MOVF 77,W
1016 0330: BCF 03.5
1017 0331: IORWF 41,F
1018 .................... if (line!=0) {Delay_ms(150); break;}
1019 0332: MOVF 41,F
1020 0333: BTFSC 03.2
1021 0334: GOTO 339
1022 0335: MOVLW 96
1023 0336: MOVWF 74
1024 0337: CALL 088
1025 0338: GOTO 33E
1026 .................... // Delay_ms(1);
1027 .................... }
1028 0339: MOVF 71,W
1029 033A: BTFSC 03.2
1030 033B: DECF 72,F
1031 033C: DECF 71,F
1032 033D: GOTO 31C
1033 ....................
1034 .................... BR; FL; // otoc se 60° do prava
1035 033E: BSF 03.5
1036 033F: BCF 06.4
1037 0340: BCF 03.5
1038 0341: BCF 06.4
1039 0342: BSF 03.5
1040 0343: BCF 06.5
1041 0344: BCF 03.5
1042 0345: BSF 06.5
1043 0346: BSF 03.5
1044 0347: BCF 06.7
1045 0348: BCF 03.5
1046 0349: BCF 06.7
1047 034A: BSF 03.5
1048 034B: BCF 06.6
1049 034C: BCF 03.5
1050 034D: BSF 06.6
1051 .................... for(n=40000;n>0;n--)
1052 034E: MOVLW 9C
1053 034F: MOVWF 72
1054 0350: MOVLW 40
1055 0351: MOVWF 71
1056 0352: MOVF 71,F
1057 0353: BTFSS 03.2
1058 0354: GOTO 358
1059 0355: MOVF 72,F
1060 0356: BTFSC 03.2
1061 0357: GOTO 370
1062 .................... {
1063 .................... line = RSENSOR; // cteni senzoru na caru
1064 0358: CLRF 41
1065 0359: BSF 03.5
1066 035A: BTFSS 1C.7
1067 035B: GOTO 35F
1068 035C: BCF 03.5
1069 035D: INCF 41,F
1070 035E: BSF 03.5
1071 .................... line |= LSENSOR << 1;
1072 035F: MOVLW 00
1073 0360: BTFSC 1C.6
1074 0361: MOVLW 01
1075 0362: MOVWF 77
1076 0363: BCF 03.0
1077 0364: RLF 77,F
1078 0365: MOVF 77,W
1079 0366: BCF 03.5
1080 0367: IORWF 41,F
1081 .................... if (line!=0) break;
1082 0368: MOVF 41,F
1083 0369: BTFSS 03.2
1084 036A: GOTO 370
1085 .................... // Delay_ms(1);
1086 .................... }
1087 036B: MOVF 71,W
1088 036C: BTFSC 03.2
1089 036D: DECF 72,F
1090 036E: DECF 71,F
1091 036F: GOTO 352
1092 .................... STOPR; STOPL;
1093 0370: BSF 03.5
1094 0371: BCF 06.4
1095 0372: BCF 03.5
1096 0373: BCF 06.4
1097 0374: BSF 03.5
1098 0375: BCF 06.5
1099 0376: BCF 03.5
1100 0377: BCF 06.5
1101 0378: BSF 03.5
1102 0379: BCF 06.6
1103 037A: BCF 03.5
1104 037B: BCF 06.6
1105 037C: BSF 03.5
1106 037D: BCF 06.7
1107 037E: BCF 03.5
1108 037F: BCF 06.7
1109 ....................
1110 .................... movement=L; //R;
1111 0380: MOVLW 02
1112 0381: MOVWF 45
1113 .................... cikcak();
1114 0382: CALL 1FD
1115 .................... dira=0;
1116 0383: CLRF 46
1117 .................... }
1118 0384: BCF 0A.3
1119 0385: GOTO 550 (RETURN)
1120 .................... ///////////////////////////////////////////////////////////////////////////////
1121 .................... void prejeddiru() // vyresi diru
1122 .................... {
1123 .................... unsigned int16 n;
1124 .................... unsigned int8 speed_dira;
1125 ....................
1126 .................... STOPL;STOPR;
1127 0386: BSF 03.5
1128 0387: BCF 06.6
1129 0388: BCF 03.5
1130 0389: BCF 06.6
1131 038A: BSF 03.5
1132 038B: BCF 06.7
1133 038C: BCF 03.5
1134 038D: BCF 06.7
1135 038E: BSF 03.5
1136 038F: BCF 06.4
1137 0390: BCF 03.5
1138 0391: BCF 06.4
1139 0392: BSF 03.5
1140 0393: BCF 06.5
1141 0394: BCF 03.5
1142 0395: BCF 06.5
1143 .................... speed_dira=speed;
1144 0396: MOVF 42,W
1145 0397: MOVWF 73
1146 .................... beep(1000,500);
1147 0398: MOVLW 03
1148 0399: MOVWF 75
1149 039A: MOVLW E8
1150 039B: MOVWF 74
1151 039C: MOVLW 01
1152 039D: MOVWF 7D
1153 039E: MOVLW F4
1154 039F: MOVWF 7C
1155 03A0: CALL 05C
1156 .................... switch (movement) //vrat se zpet na caru
1157 .................... {
1158 03A1: MOVF 45,W
1159 03A2: XORLW 02
1160 03A3: BTFSC 03.2
1161 03A4: GOTO 3AC
1162 03A5: XORLW 03
1163 03A6: BTFSC 03.2
1164 03A7: GOTO 3E4
1165 03A8: XORLW 02
1166 03A9: BTFSC 03.2
1167 03AA: GOTO 41C
1168 03AB: GOTO 41E
1169 .................... case L:
1170 .................... for (n=COUVANI;n>0;n--) {GO(R,B,speed_dira); Delay_ms(1);}
1171 03AC: MOVLW 02
1172 03AD: MOVWF 72
1173 03AE: MOVLW EE
1174 03AF: MOVWF 71
1175 03B0: MOVF 71,F
1176 03B1: BTFSS 03.2
1177 03B2: GOTO 3B6
1178 03B3: MOVF 72,F
1179 03B4: BTFSC 03.2
1180 03B5: GOTO 3D3
1181 03B6: MOVF 01,W
1182 03B7: SUBWF 73,W
1183 03B8: BTFSS 03.0
1184 03B9: GOTO 3C3
1185 03BA: BSF 03.5
1186 03BB: BCF 06.4
1187 03BC: BCF 03.5
1188 03BD: BCF 06.4
1189 03BE: BSF 03.5
1190 03BF: BCF 06.5
1191 03C0: BCF 03.5
1192 03C1: BSF 06.5
1193 03C2: GOTO 3CB
1194 03C3: BSF 03.5
1195 03C4: BCF 06.4
1196 03C5: BCF 03.5
1197 03C6: BCF 06.4
1198 03C7: BSF 03.5
1199 03C8: BCF 06.5
1200 03C9: BCF 03.5
1201 03CA: BCF 06.5
1202 03CB: MOVLW 01
1203 03CC: MOVWF 74
1204 03CD: CALL 088
1205 03CE: MOVF 71,W
1206 03CF: BTFSC 03.2
1207 03D0: DECF 72,F
1208 03D1: DECF 71,F
1209 03D2: GOTO 3B0
1210 .................... STOPL;STOPR;
1211 03D3: BSF 03.5
1212 03D4: BCF 06.6
1213 03D5: BCF 03.5
1214 03D6: BCF 06.6
1215 03D7: BSF 03.5
1216 03D8: BCF 06.7
1217 03D9: BCF 03.5
1218 03DA: BCF 06.7
1219 03DB: BSF 03.5
1220 03DC: BCF 06.4
1221 03DD: BCF 03.5
1222 03DE: BCF 06.4
1223 03DF: BSF 03.5
1224 03E0: BCF 06.5
1225 03E1: BCF 03.5
1226 03E2: BCF 06.5
1227 .................... break;
1228 03E3: GOTO 41E
1229 .................... case R:
1230 .................... for (n=COUVANI;n>0;n--) {GO(L,B,speed_dira); Delay_ms(1);}
1231 03E4: MOVLW 02
1232 03E5: MOVWF 72
1233 03E6: MOVLW EE
1234 03E7: MOVWF 71
1235 03E8: MOVF 71,F
1236 03E9: BTFSS 03.2
1237 03EA: GOTO 3EE
1238 03EB: MOVF 72,F
1239 03EC: BTFSC 03.2
1240 03ED: GOTO 40B
1241 03EE: MOVF 01,W
1242 03EF: SUBWF 73,W
1243 03F0: BTFSS 03.0
1244 03F1: GOTO 3FB
1245 03F2: BSF 03.5
1246 03F3: BCF 06.6
1247 03F4: BCF 03.5
1248 03F5: BCF 06.6
1249 03F6: BSF 03.5
1250 03F7: BCF 06.7
1251 03F8: BCF 03.5
1252 03F9: BSF 06.7
1253 03FA: GOTO 403
1254 03FB: BSF 03.5
1255 03FC: BCF 06.6
1256 03FD: BCF 03.5
1257 03FE: BCF 06.6
1258 03FF: BSF 03.5
1259 0400: BCF 06.7
1260 0401: BCF 03.5
1261 0402: BCF 06.7
1262 0403: MOVLW 01
1263 0404: MOVWF 74
1264 0405: CALL 088
1265 0406: MOVF 71,W
1266 0407: BTFSC 03.2
1267 0408: DECF 72,F
1268 0409: DECF 71,F
1269 040A: GOTO 3E8
1270 .................... STOPL;STOPR;
1271 040B: BSF 03.5
1272 040C: BCF 06.6
1273 040D: BCF 03.5
1274 040E: BCF 06.6
1275 040F: BSF 03.5
1276 0410: BCF 06.7
1277 0411: BCF 03.5
1278 0412: BCF 06.7
1279 0413: BSF 03.5
1280 0414: BCF 06.4
1281 0415: BCF 03.5
1282 0416: BCF 06.4
1283 0417: BSF 03.5
1284 0418: BCF 06.5
1285 0419: BCF 03.5
1286 041A: BCF 06.5
1287 .................... break;
1288 041B: GOTO 41E
1289 .................... case S:
1290 .................... goto sem;
1291 041C: GOTO 45C
1292 .................... break;
1293 041D: GOTO 41E
1294 .................... }
1295 .................... beep(1000,500);
1296 041E: MOVLW 03
1297 041F: MOVWF 75
1298 0420: MOVLW E8
1299 0421: MOVWF 74
1300 0422: MOVLW 01
1301 0423: MOVWF 7D
1302 0424: MOVLW F4
1303 0425: MOVWF 7C
1304 0426: CALL 05C
1305 ....................
1306 .................... /*line=0;
1307 .................... FR; BL; Delay_ms(400); // otoc se na caru
1308 .................... beep(1000,500);
1309 .................... while(line==0)
1310 .................... {
1311 .................... line = RSENSOR; // cteni senzoru na caru
1312 .................... line |= LSENSOR << 1;
1313 .................... }
1314 .................... FL;BR; Delay_ms(60); // zabrzdi
1315 .................... STOPL; STOPR;
1316 ....................
1317 .................... FL; BR; Delay_ms(700); // otacka 180 deg
1318 .................... STOPL; STOPR;*/
1319 ....................
1320 .................... FR;FL; //popojed rovne
1321 0427: BSF 03.5
1322 0428: BCF 06.5
1323 0429: BCF 03.5
1324 042A: BCF 06.5
1325 042B: BSF 03.5
1326 042C: BCF 06.4
1327 042D: BCF 03.5
1328 042E: BSF 06.4
1329 042F: BSF 03.5
1330 0430: BCF 06.7
1331 0431: BCF 03.5
1332 0432: BCF 06.7
1333 0433: BSF 03.5
1334 0434: BCF 06.6
1335 0435: BCF 03.5
1336 0436: BSF 06.6
1337 .................... for(n=PRES_DIRU;n>0;n--)
1338 0437: MOVLW 01
1339 0438: MOVWF 72
1340 0439: MOVLW 2C
1341 043A: MOVWF 71
1342 043B: MOVF 71,F
1343 043C: BTFSS 03.2
1344 043D: GOTO 441
1345 043E: MOVF 72,F
1346 043F: BTFSC 03.2
1347 0440: GOTO 45C
1348 .................... {
1349 .................... line = RSENSOR; // cteni senzoru na caru
1350 0441: CLRF 41
1351 0442: BSF 03.5
1352 0443: BTFSS 1C.7
1353 0444: GOTO 448
1354 0445: BCF 03.5
1355 0446: INCF 41,F
1356 0447: BSF 03.5
1357 .................... line |= LSENSOR << 1;
1358 0448: MOVLW 00
1359 0449: BTFSC 1C.6
1360 044A: MOVLW 01
1361 044B: MOVWF 77
1362 044C: BCF 03.0
1363 044D: RLF 77,F
1364 044E: MOVF 77,W
1365 044F: BCF 03.5
1366 0450: IORWF 41,F
1367 .................... if (line!=0) break;
1368 0451: MOVF 41,F
1369 0452: BTFSS 03.2
1370 0453: GOTO 45C
1371 .................... Delay_ms(1);
1372 0454: MOVLW 01
1373 0455: MOVWF 74
1374 0456: CALL 088
1375 .................... }
1376 0457: MOVF 71,W
1377 0458: BTFSC 03.2
1378 0459: DECF 72,F
1379 045A: DECF 71,F
1380 045B: GOTO 43B
1381 .................... sem:
1382 .................... STOPL; STOPR;
1383 045C: BSF 03.5
1384 045D: BCF 06.6
1385 045E: BCF 03.5
1386 045F: BCF 06.6
1387 0460: BSF 03.5
1388 0461: BCF 06.7
1389 0462: BCF 03.5
1390 0463: BCF 06.7
1391 0464: BSF 03.5
1392 0465: BCF 06.4
1393 0466: BCF 03.5
1394 0467: BCF 06.4
1395 0468: BSF 03.5
1396 0469: BCF 06.5
1397 046A: BCF 03.5
1398 046B: BCF 06.5
1399 .................... movement=S;
1400 046C: MOVLW 03
1401 046D: MOVWF 45
1402 .................... cikcak(); // najdi caru
1403 046E: CALL 1FD
1404 .................... dira=0;
1405 046F: CLRF 46
1406 .................... }
1407 0470: BCF 0A.3
1408 0471: GOTO 5E6 (RETURN)
1409 .................... ///////////////////////////////////////////////////////////////////////////////
1410 .................... void main()
1411 .................... {
1412 0472: CLRF 04
1413 0473: MOVLW 1F
1414 0474: ANDWF 03,F
1415 0475: BSF 03.5
1416 0476: BCF 1F.4
1417 0477: BCF 1F.5
1418 0478: MOVF 1B,W
1419 0479: ANDLW 80
1420 047A: MOVWF 1B
1421 047B: MOVLW 07
1422 047C: MOVWF 1C
1423 047D: MOVF 1C,W
1424 047E: BCF 03.5
1425 047F: BCF 0D.6
1426 0480: MOVLW 60
1427 0481: BSF 03.5
1428 0482: MOVWF 0F
1429 .................... unsigned int16 n; // pro FOR
1430 ....................
1431 .................... STOPL; STOPR; // prepne vystupy na ovladani motoru na output a zastavi
1432 *
1433 049F: BSF 03.5
1434 04A0: BCF 06.6
1435 04A1: BCF 03.5
1436 04A2: BCF 06.6
1437 04A3: BSF 03.5
1438 04A4: BCF 06.7
1439 04A5: BCF 03.5
1440 04A6: BCF 06.7
1441 04A7: BSF 03.5
1442 04A8: BCF 06.4
1443 04A9: BCF 03.5
1444 04AA: BCF 06.4
1445 04AB: BSF 03.5
1446 04AC: BCF 06.5
1447 04AD: BCF 03.5
1448 04AE: BCF 06.5
1449 ....................
1450 .................... setup_oscillator(OSC_4MHZ|OSC_INTRC); // 4 MHz interni RC oscilator
1451 04AF: MOVLW 62
1452 04B0: BSF 03.5
1453 04B1: MOVWF 0F
1454 ....................
1455 .................... port_b_pullups(TRUE); // pullups pro piano na diagnostiku
1456 04B2: BCF 01.7
1457 .................... setup_spi(FALSE);
1458 04B3: BCF 03.5
1459 04B4: BCF 14.5
1460 04B5: BSF 03.5
1461 04B6: BCF 06.2
1462 04B7: BSF 06.1
1463 04B8: BCF 06.4
1464 04B9: MOVLW 00
1465 04BA: BCF 03.5
1466 04BB: MOVWF 14
1467 04BC: BSF 03.5
1468 04BD: MOVWF 14
1469 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); // Casovac pro PWM
1470 04BE: MOVF 01,W
1471 04BF: ANDLW C7
1472 04C0: IORLW 08
1473 04C1: MOVWF 01
1474 ....................
1475 .................... setup_timer_2(T2_DIV_BY_4,255,10); // Casovac pro regulaci
1476 04C2: MOVLW 48
1477 04C3: MOVWF 78
1478 04C4: IORLW 05
1479 04C5: BCF 03.5
1480 04C6: MOVWF 12
1481 04C7: MOVLW FF
1482 04C8: BSF 03.5
1483 04C9: MOVWF 12
1484 .................... // preruseni kazdych 10ms
1485 .................... setup_adc_ports(sAN2|VSS_VDD); // nastaveni A/D prevodniku pro naraznik
1486 04CA: BCF 1F.4
1487 04CB: BCF 1F.5
1488 04CC: MOVF 1B,W
1489 04CD: ANDLW 80
1490 04CE: IORLW 04
1491 04CF: MOVWF 1B
1492 .................... setup_adc(ADC_CLOCK_INTERNAL);
1493 04D0: BCF 1F.6
1494 04D1: BCF 03.5
1495 04D2: BSF 1F.6
1496 04D3: BSF 1F.7
1497 04D4: BSF 03.5
1498 04D5: BCF 1F.7
1499 04D6: BCF 03.5
1500 04D7: BSF 1F.0
1501 .................... set_adc_channel(2);
1502 04D8: MOVLW 10
1503 04D9: MOVWF 78
1504 04DA: MOVF 1F,W
1505 04DB: ANDLW C7
1506 04DC: IORWF 78,W
1507 04DD: MOVWF 1F
1508 .................... setup_timer_1(T1_INTERNAL|T1_DIV_BY_1); // Casovac pro naraznik
1509 04DE: MOVLW 85
1510 04DF: MOVWF 10
1511 .................... setup_ccp1(CCP_COMPARE_RESET_TIMER);
1512 04E0: BSF 03.5
1513 04E1: BSF 06.3
1514 04E2: MOVLW 0B
1515 04E3: BCF 03.5
1516 04E4: MOVWF 17
1517 .................... CCP_1=(2^10)-1; // prevod kazdou 1ms
1518 04E5: CLRF 16
1519 04E6: MOVLW 07
1520 04E7: MOVWF 15
1521 ....................
1522 .................... setup_comparator(A0_VR_A1_VR); // inicializace komparatoru pro cidla cary
1523 04E8: MOVLW 02
1524 04E9: BSF 03.5
1525 04EA: MOVWF 1C
1526 04EB: MOVF 05,W
1527 04EC: IORLW 03
1528 04ED: MOVWF 05
1529 04EE: MOVLW 03
1530 04EF: MOVWF 77
1531 04F0: DECFSZ 77,F
1532 04F1: GOTO 4F0
1533 04F2: MOVF 1C,W
1534 04F3: BCF 03.5
1535 04F4: BCF 0D.6
1536 .................... setup_vref(VREF_HIGH|TRESHOLD); // 32 kroku od 0.25 do 0.75 Vdd
1537 04F5: MOVLW 86
1538 04F6: BSF 03.5
1539 04F7: MOVWF 1D
1540 ....................
1541 .................... Beep(1000,200); //double beep
1542 04F8: MOVLW 03
1543 04F9: MOVWF 75
1544 04FA: MOVLW E8
1545 04FB: MOVWF 74
1546 04FC: CLRF 7D
1547 04FD: MOVLW C8
1548 04FE: MOVWF 7C
1549 04FF: BCF 03.5
1550 0500: CALL 05C
1551 .................... Delay_ms(50);
1552 0501: MOVLW 32
1553 0502: MOVWF 74
1554 0503: CALL 088
1555 .................... Beep(1000,200);
1556 0504: MOVLW 03
1557 0505: MOVWF 75
1558 0506: MOVLW E8
1559 0507: MOVWF 74
1560 0508: CLRF 7D
1561 0509: MOVLW C8
1562 050A: MOVWF 7C
1563 050B: CALL 05C
1564 .................... Delay_ms(1000); // 1s
1565 050C: MOVLW 04
1566 050D: MOVWF 71
1567 050E: MOVLW FA
1568 050F: MOVWF 74
1569 0510: CALL 088
1570 0511: DECFSZ 71,F
1571 0512: GOTO 50E
1572 ....................
1573 .................... // povoleni rizeni rychlosti zataceni pres preruseni
1574 .................... enable_interrupts(INT_TIMER2);
1575 0513: BSF 03.5
1576 0514: BSF 0C.1
1577 .................... enable_interrupts(GLOBAL);
1578 0515: MOVLW C0
1579 0516: BCF 03.5
1580 0517: IORWF 0B,F
1581 ....................
1582 .................... /*---------------------------------------------------------------------------*/
1583 .................... sensors=S;
1584 0518: MOVLW 03
1585 0519: MOVWF 40
1586 .................... line=S;
1587 051A: MOVWF 41
1588 .................... last=S;
1589 051B: MOVWF 44
1590 .................... movement=S;
1591 051C: MOVWF 45
1592 .................... speed=FW_POMALU;
1593 051D: MOVLW E6
1594 051E: MOVWF 42
1595 ....................
1596 .................... diagnostika();
1597 051F: GOTO 09D
1598 .................... //cikcak(); // toc se, abys nasel caru
1599 .................... Delay_ms(500);
1600 0520: MOVLW 02
1601 0521: MOVWF 71
1602 0522: MOVLW FA
1603 0523: MOVWF 74
1604 0524: CALL 088
1605 0525: DECFSZ 71,F
1606 0526: GOTO 522
1607 .................... Beep(1000,200);
1608 0527: MOVLW 03
1609 0528: MOVWF 75
1610 0529: MOVLW E8
1611 052A: MOVWF 74
1612 052B: CLRF 7D
1613 052C: MOVLW C8
1614 052D: MOVWF 7C
1615 052E: CALL 05C
1616 .................... Delay_ms(500);
1617 052F: MOVLW 02
1618 0530: MOVWF 71
1619 0531: MOVLW FA
1620 0532: MOVWF 74
1621 0533: CALL 088
1622 0534: DECFSZ 71,F
1623 0535: GOTO 531
1624 ....................
1625 .................... while(true) // hlavni smycka (jizda podle cary)
1626 .................... {
1627 .................... sensors = RSENSOR; // cteni senzoru na caru
1628 0536: CLRF 40
1629 0537: BSF 03.5
1630 0538: BTFSS 1C.7
1631 0539: GOTO 53D
1632 053A: BCF 03.5
1633 053B: INCF 40,F
1634 053C: BSF 03.5
1635 .................... sensors |= LSENSOR << 1;
1636 053D: MOVLW 00
1637 053E: BTFSC 1C.6
1638 053F: MOVLW 01
1639 0540: MOVWF 77
1640 0541: BCF 03.0
1641 0542: RLF 77,F
1642 0543: MOVF 77,W
1643 0544: BCF 03.5
1644 0545: IORWF 40,F
1645 ....................
1646 .................... if ((read_adc(ADC_READ_ONLY)<BUMPER_TRESHOLD) && (dira<=T_CIHLA)) objizdka();
1647 0546: BTFSC 1F.2
1648 0547: GOTO 546
1649 0548: MOVF 1E,W
1650 0549: SUBLW 7F
1651 054A: BTFSS 03.0
1652 054B: GOTO 550
1653 054C: MOVF 46,W
1654 054D: SUBLW 32
1655 054E: BTFSC 03.0
1656 054F: GOTO 289
1657 ....................
1658 .................... switch (sensors) // zatacej podle toho, kde vidis caru
1659 .................... {
1660 0550: MOVF 40,W
1661 0551: XORLW 03
1662 0552: BTFSC 03.2
1663 0553: GOTO 55B
1664 0554: XORLW 01
1665 0555: BTFSC 03.2
1666 0556: GOTO 56F
1667 0557: XORLW 03
1668 0558: BTFSC 03.2
1669 0559: GOTO 5A8
1670 055A: GOTO 5E1
1671 .................... case S: // rovne
1672 .................... FL; FR; // pokud se jede dlouho rovne, tak pridej
1673 055B: BSF 03.5
1674 055C: BCF 06.7
1675 055D: BCF 03.5
1676 055E: BCF 06.7
1677 055F: BSF 03.5
1678 0560: BCF 06.6
1679 0561: BCF 03.5
1680 0562: BSF 06.6
1681 0563: BSF 03.5
1682 0564: BCF 06.5
1683 0565: BCF 03.5
1684 0566: BCF 06.5
1685 0567: BSF 03.5
1686 0568: BCF 06.4
1687 0569: BCF 03.5
1688 056A: BSF 06.4
1689 .................... dira=0;
1690 056B: CLRF 46
1691 .................... movement=S;
1692 056C: MOVLW 03
1693 056D: MOVWF 45
1694 .................... continue;
1695 056E: GOTO 536
1696 .................... case L: // trochu vlevo
1697 .................... GO(L, F, FW_POMALU+rovinka); GO(R, F, FW_STREDNE+rovinka);
1698 056F: MOVF 01,W
1699 0570: MOVWF 71
1700 0571: MOVLW E6
1701 0572: ADDWF 43,W
1702 0573: SUBWF 71,W
1703 0574: BTFSC 03.2
1704 0575: GOTO 578
1705 0576: BTFSC 03.0
1706 0577: GOTO 581
1707 0578: BSF 03.5
1708 0579: BCF 06.7
1709 057A: BCF 03.5
1710 057B: BCF 06.7
1711 057C: BSF 03.5
1712 057D: BCF 06.6
1713 057E: BCF 03.5
1714 057F: BSF 06.6
1715 0580: GOTO 589
1716 0581: BSF 03.5
1717 0582: BCF 06.6
1718 0583: BCF 03.5
1719 0584: BCF 06.6
1720 0585: BSF 03.5
1721 0586: BCF 06.7
1722 0587: BCF 03.5
1723 0588: BCF 06.7
1724 0589: MOVF 01,W
1725 058A: MOVWF 71
1726 058B: MOVLW F0
1727 058C: ADDWF 43,W
1728 058D: SUBWF 71,W
1729 058E: BTFSC 03.2
1730 058F: GOTO 592
1731 0590: BTFSC 03.0
1732 0591: GOTO 59B
1733 0592: BSF 03.5
1734 0593: BCF 06.5
1735 0594: BCF 03.5
1736 0595: BCF 06.5
1737 0596: BSF 03.5
1738 0597: BCF 06.4
1739 0598: BCF 03.5
1740 0599: BSF 06.4
1741 059A: GOTO 5A3
1742 059B: BSF 03.5
1743 059C: BCF 06.4
1744 059D: BCF 03.5
1745 059E: BCF 06.4
1746 059F: BSF 03.5
1747 05A0: BCF 06.5
1748 05A1: BCF 03.5
1749 05A2: BCF 06.5
1750 .................... line=L;
1751 05A3: MOVLW 02
1752 05A4: MOVWF 41
1753 .................... dira=0;
1754 05A5: CLRF 46
1755 .................... movement=L;
1756 05A6: MOVWF 45
1757 .................... continue;
1758 05A7: GOTO 536
1759 .................... case R: // trochu vpravo
1760 .................... GO(R, F, FW_POMALU+rovinka); GO(L, F, FW_STREDNE+rovinka);
1761 05A8: MOVF 01,W
1762 05A9: MOVWF 71
1763 05AA: MOVLW E6
1764 05AB: ADDWF 43,W
1765 05AC: SUBWF 71,W
1766 05AD: BTFSC 03.2
1767 05AE: GOTO 5B1
1768 05AF: BTFSC 03.0
1769 05B0: GOTO 5BA
1770 05B1: BSF 03.5
1771 05B2: BCF 06.5
1772 05B3: BCF 03.5
1773 05B4: BCF 06.5
1774 05B5: BSF 03.5
1775 05B6: BCF 06.4
1776 05B7: BCF 03.5
1777 05B8: BSF 06.4
1778 05B9: GOTO 5C2
1779 05BA: BSF 03.5
1780 05BB: BCF 06.4
1781 05BC: BCF 03.5
1782 05BD: BCF 06.4
1783 05BE: BSF 03.5
1784 05BF: BCF 06.5
1785 05C0: BCF 03.5
1786 05C1: BCF 06.5
1787 05C2: MOVF 01,W
1788 05C3: MOVWF 71
1789 05C4: MOVLW F0
1790 05C5: ADDWF 43,W
1791 05C6: SUBWF 71,W
1792 05C7: BTFSC 03.2
1793 05C8: GOTO 5CB
1794 05C9: BTFSC 03.0
1795 05CA: GOTO 5D4
1796 05CB: BSF 03.5
1797 05CC: BCF 06.7
1798 05CD: BCF 03.5
1799 05CE: BCF 06.7
1800 05CF: BSF 03.5
1801 05D0: BCF 06.6
1802 05D1: BCF 03.5
1803 05D2: BSF 06.6
1804 05D3: GOTO 5DC
1805 05D4: BSF 03.5
1806 05D5: BCF 06.6
1807 05D6: BCF 03.5
1808 05D7: BCF 06.6
1809 05D8: BSF 03.5
1810 05D9: BCF 06.7
1811 05DA: BCF 03.5
1812 05DB: BCF 06.7
1813 .................... line=R;
1814 05DC: MOVLW 01
1815 05DD: MOVWF 41
1816 .................... dira=0;
1817 05DE: CLRF 46
1818 .................... movement=R;
1819 05DF: MOVWF 45
1820 .................... continue;
1821 05E0: GOTO 536
1822 .................... default: // kdyz jsou obe cidla mimo caru, tak pokracuj dal
1823 .................... }
1824 .................... rovinka=0;
1825 05E1: CLRF 43
1826 .................... if (dira>=T_DIRA) prejeddiru();
1827 05E2: MOVF 46,W
1828 05E3: SUBLW 77
1829 05E4: BTFSS 03.0
1830 05E5: GOTO 386
1831 .................... if (last!=line) // pokud si prejel caru z jedne strany na druhou stranu, tak zabrzdi
1832 05E6: MOVF 41,W
1833 05E7: SUBWF 44,W
1834 05E8: BTFSC 03.2
1835 05E9: GOTO 5EE
1836 .................... {
1837 .................... last=line;
1838 05EA: MOVF 41,W
1839 05EB: MOVWF 44
1840 .................... speed=FW_ZATACKA;
1841 05EC: MOVLW F0
1842 05ED: MOVWF 42
1843 .................... }
1844 .................... if (L==line) // kdyz jsou obe cidla mimo caru, zatoc na caru
1845 05EE: MOVF 41,W
1846 05EF: SUBLW 02
1847 05F0: BTFSS 03.2
1848 05F1: GOTO 612
1849 .................... {
1850 .................... STOPL;
1851 05F2: BSF 03.5
1852 05F3: BCF 06.6
1853 05F4: BCF 03.5
1854 05F5: BCF 06.6
1855 05F6: BSF 03.5
1856 05F7: BCF 06.7
1857 05F8: BCF 03.5
1858 05F9: BCF 06.7
1859 .................... GO(R, F, speed);
1860 05FA: MOVF 01,W
1861 05FB: SUBWF 42,W
1862 05FC: BTFSS 03.0
1863 05FD: GOTO 607
1864 05FE: BSF 03.5
1865 05FF: BCF 06.5
1866 0600: BCF 03.5
1867 0601: BCF 06.5
1868 0602: BSF 03.5
1869 0603: BCF 06.4
1870 0604: BCF 03.5
1871 0605: BSF 06.4
1872 0606: GOTO 60F
1873 0607: BSF 03.5
1874 0608: BCF 06.4
1875 0609: BCF 03.5
1876 060A: BCF 06.4
1877 060B: BSF 03.5
1878 060C: BCF 06.5
1879 060D: BCF 03.5
1880 060E: BCF 06.5
1881 .................... movement=L;
1882 060F: MOVLW 02
1883 0610: MOVWF 45
1884 .................... }
1885 .................... else
1886 0611: GOTO 631
1887 .................... {
1888 .................... STOPR;
1889 0612: BSF 03.5
1890 0613: BCF 06.4
1891 0614: BCF 03.5
1892 0615: BCF 06.4
1893 0616: BSF 03.5
1894 0617: BCF 06.5
1895 0618: BCF 03.5
1896 0619: BCF 06.5
1897 .................... GO(L, F, speed);
1898 061A: MOVF 01,W
1899 061B: SUBWF 42,W
1900 061C: BTFSS 03.0
1901 061D: GOTO 627
1902 061E: BSF 03.5
1903 061F: BCF 06.7
1904 0620: BCF 03.5
1905 0621: BCF 06.7
1906 0622: BSF 03.5
1907 0623: BCF 06.6
1908 0624: BCF 03.5
1909 0625: BSF 06.6
1910 0626: GOTO 62F
1911 0627: BSF 03.5
1912 0628: BCF 06.6
1913 0629: BCF 03.5
1914 062A: BCF 06.6
1915 062B: BSF 03.5
1916 062C: BCF 06.7
1917 062D: BCF 03.5
1918 062E: BCF 06.7
1919 .................... movement=R;
1920 062F: MOVLW 01
1921 0630: MOVWF 45
1922 .................... }
1923 .................... } // while(true)
1924 0631: GOTO 536
1925 .................... }
1926 ....................
1927 ....................
1928 0632: SLEEP
1929  
1930 Configuration Fuses:
1931 Word 1: 3F38 NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
1932 Word 2: 3FFC NOFCMEN NOIESO