Rev Author Line No. Line
503 kaklik 1 CCS PCM C Compiler, Version 3.221, 27853 26-IV-05 21:32
2  
3 Filename: D:\KAKLIK\programy\PIC_C\roboti\merkur\PIC16F88\turn_L\tank.LST
4  
5 ROM used: 1705 words (42%)
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 4E8
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 75
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 87 // 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 200 // rychlost vnejsiho kola pri zataceni
143 .................... #define FW_STREDNE 240 // trochu mimo caru vnejsi pas
144 .................... #define COUVANI 600 // couvnuti zpet na caru, po detekci diry
145 .................... #define PRES_DIRU 250
146 .................... #define MAX_ROVINKA (255-FW_STREDNE)
147 .................... #define TRESHOLD 10 // 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 57
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 75
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 75
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 75
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 75
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 75
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 75
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 75
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 75
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 75
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 75
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 75
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 75
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 75
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 75
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 75
584 01C4: CALL 088
585 01C5: DECFSZ 73,F
586 01C6: GOTO 1C2
587 .................... };
588 01C7: GOTO 09D
589 .................... while (input(DIAG_SENSORS))
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 596 (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(200);
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 C8
849 029A: MOVWF 75
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 .................... BL; FR; Delay_ms(215); // otoc se 70° do leva
882 02B5: BSF 03.5
883 02B6: BCF 06.6
884 02B7: BCF 03.5
885 02B8: BCF 06.6
886 02B9: BSF 03.5
887 02BA: BCF 06.7
888 02BB: BCF 03.5
889 02BC: BSF 06.7
890 02BD: BSF 03.5
891 02BE: BCF 06.5
892 02BF: BCF 03.5
893 02C0: BCF 06.5
894 02C1: BSF 03.5
895 02C2: BCF 06.4
896 02C3: BCF 03.5
897 02C4: BSF 06.4
898 02C5: MOVLW D7
899 02C6: MOVWF 75
900 02C7: CALL 088
901 ....................
902 .................... FR; FL; Delay_ms(600); // popojed rovne
903 02C8: BSF 03.5
904 02C9: BCF 06.5
905 02CA: BCF 03.5
906 02CB: BCF 06.5
907 02CC: BSF 03.5
908 02CD: BCF 06.4
909 02CE: BCF 03.5
910 02CF: BSF 06.4
911 02D0: BSF 03.5
912 02D1: BCF 06.7
913 02D2: BCF 03.5
914 02D3: BCF 06.7
915 02D4: BSF 03.5
916 02D5: BCF 06.6
917 02D6: BCF 03.5
918 02D7: BSF 06.6
919 02D8: MOVLW 03
920 02D9: MOVWF 73
921 02DA: MOVLW C8
922 02DB: MOVWF 75
923 02DC: CALL 088
924 02DD: DECFSZ 73,F
925 02DE: GOTO 2DA
926 ....................
927 .................... BR; Delay_ms(50); // otoc se 90° do prava
928 02DF: BSF 03.5
929 02E0: BCF 06.4
930 02E1: BCF 03.5
931 02E2: BCF 06.4
932 02E3: BSF 03.5
933 02E4: BCF 06.5
934 02E5: BCF 03.5
935 02E6: BSF 06.5
936 02E7: MOVLW 32
937 02E8: MOVWF 75
938 02E9: CALL 088
939 .................... STOPR; FL; Delay_ms(600);
940 02EA: BSF 03.5
941 02EB: BCF 06.4
942 02EC: BCF 03.5
943 02ED: BCF 06.4
944 02EE: BSF 03.5
945 02EF: BCF 06.5
946 02F0: BCF 03.5
947 02F1: BCF 06.5
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.6
954 02F8: BCF 03.5
955 02F9: BSF 06.6
956 02FA: MOVLW 03
957 02FB: MOVWF 73
958 02FC: MOVLW C8
959 02FD: MOVWF 75
960 02FE: CALL 088
961 02FF: DECFSZ 73,F
962 0300: GOTO 2FC
963 ....................
964 .................... FR; FL; Delay_ms(100); // popojed rovne na slepo
965 0301: BSF 03.5
966 0302: BCF 06.5
967 0303: BCF 03.5
968 0304: BCF 06.5
969 0305: BSF 03.5
970 0306: BCF 06.4
971 0307: BCF 03.5
972 0308: BSF 06.4
973 0309: BSF 03.5
974 030A: BCF 06.7
975 030B: BCF 03.5
976 030C: BCF 06.7
977 030D: BSF 03.5
978 030E: BCF 06.6
979 030F: BCF 03.5
980 0310: BSF 06.6
981 0311: MOVLW 64
982 0312: MOVWF 75
983 0313: CALL 088
984 .................... for(n=600;n>0;n--) // popojed rovne ale kontroluj caru
985 0314: MOVLW 02
986 0315: MOVWF 72
987 0316: MOVLW 58
988 0317: MOVWF 71
989 0318: MOVF 71,F
990 0319: BTFSS 03.2
991 031A: GOTO 31E
992 031B: MOVF 72,F
993 031C: BTFSC 03.2
994 031D: GOTO 33D
995 .................... {
996 .................... line = RSENSOR; // cteni senzoru na caru
997 031E: CLRF 41
998 031F: BSF 03.5
999 0320: BTFSS 1C.7
1000 0321: GOTO 325
1001 0322: BCF 03.5
1002 0323: INCF 41,F
1003 0324: BSF 03.5
1004 .................... line |= LSENSOR << 1;
1005 0325: MOVLW 00
1006 0326: BTFSC 1C.6
1007 0327: MOVLW 01
1008 0328: MOVWF 77
1009 0329: BCF 03.0
1010 032A: RLF 77,F
1011 032B: MOVF 77,W
1012 032C: BCF 03.5
1013 032D: IORWF 41,F
1014 .................... if (line!=0) {Delay_ms(50); break;} // kdyz narazis na caru, za chvili zastav
1015 032E: MOVF 41,F
1016 032F: BTFSC 03.2
1017 0330: GOTO 335
1018 0331: MOVLW 32
1019 0332: MOVWF 75
1020 0333: CALL 088
1021 0334: GOTO 33D
1022 .................... Delay_ms(1);
1023 0335: MOVLW 01
1024 0336: MOVWF 75
1025 0337: CALL 088
1026 .................... }
1027 0338: MOVF 71,W
1028 0339: BTFSC 03.2
1029 033A: DECF 72,F
1030 033B: DECF 71,F
1031 033C: GOTO 318
1032 ....................
1033 .................... BL; // otoc se 60° do leva
1034 033D: BSF 03.5
1035 033E: BCF 06.6
1036 033F: BCF 03.5
1037 0340: BCF 06.6
1038 0341: BSF 03.5
1039 0342: BCF 06.7
1040 0343: BCF 03.5
1041 0344: BSF 06.7
1042 .................... for(n=600;n>0;n--)
1043 0345: MOVLW 02
1044 0346: MOVWF 72
1045 0347: MOVLW 58
1046 0348: MOVWF 71
1047 0349: MOVF 71,F
1048 034A: BTFSS 03.2
1049 034B: GOTO 34F
1050 034C: MOVF 72,F
1051 034D: BTFSC 03.2
1052 034E: GOTO 36A
1053 .................... {
1054 .................... line = RSENSOR; // cteni senzoru na caru
1055 034F: CLRF 41
1056 0350: BSF 03.5
1057 0351: BTFSS 1C.7
1058 0352: GOTO 356
1059 0353: BCF 03.5
1060 0354: INCF 41,F
1061 0355: BSF 03.5
1062 .................... line |= LSENSOR << 1;
1063 0356: MOVLW 00
1064 0357: BTFSC 1C.6
1065 0358: MOVLW 01
1066 0359: MOVWF 77
1067 035A: BCF 03.0
1068 035B: RLF 77,F
1069 035C: MOVF 77,W
1070 035D: BCF 03.5
1071 035E: IORWF 41,F
1072 .................... if (line!=0) break;
1073 035F: MOVF 41,F
1074 0360: BTFSS 03.2
1075 0361: GOTO 36A
1076 .................... Delay_ms(1);
1077 0362: MOVLW 01
1078 0363: MOVWF 75
1079 0364: CALL 088
1080 .................... }
1081 0365: MOVF 71,W
1082 0366: BTFSC 03.2
1083 0367: DECF 72,F
1084 0368: DECF 71,F
1085 0369: GOTO 349
1086 .................... STOPR; STOPL;
1087 036A: BSF 03.5
1088 036B: BCF 06.4
1089 036C: BCF 03.5
1090 036D: BCF 06.4
1091 036E: BSF 03.5
1092 036F: BCF 06.5
1093 0370: BCF 03.5
1094 0371: BCF 06.5
1095 0372: BSF 03.5
1096 0373: BCF 06.6
1097 0374: BCF 03.5
1098 0375: BCF 06.6
1099 0376: BSF 03.5
1100 0377: BCF 06.7
1101 0378: BCF 03.5
1102 0379: BCF 06.7
1103 ....................
1104 .................... movement=R;
1105 037A: MOVLW 01
1106 037B: MOVWF 45
1107 .................... cikcak();
1108 037C: CALL 1FD
1109 .................... dira=0;
1110 037D: CLRF 46
1111 .................... }
1112 037E: BCF 0A.3
1113 037F: GOTO 5C6 (RETURN)
1114 .................... ///////////////////////////////////////////////////////////////////////////////
1115 .................... void prejeddiru() // vyresi diru
1116 .................... {
1117 .................... unsigned int16 n;
1118 .................... unsigned int8 speed_dira;
1119 ....................
1120 .................... STOPL;STOPR;
1121 0380: BSF 03.5
1122 0381: BCF 06.6
1123 0382: BCF 03.5
1124 0383: BCF 06.6
1125 0384: BSF 03.5
1126 0385: BCF 06.7
1127 0386: BCF 03.5
1128 0387: BCF 06.7
1129 0388: BSF 03.5
1130 0389: BCF 06.4
1131 038A: BCF 03.5
1132 038B: BCF 06.4
1133 038C: BSF 03.5
1134 038D: BCF 06.5
1135 038E: BCF 03.5
1136 038F: BCF 06.5
1137 .................... speed_dira=speed;
1138 0390: MOVF 42,W
1139 0391: MOVWF 73
1140 .................... beep(1000,500);
1141 0392: MOVLW 03
1142 0393: MOVWF 75
1143 0394: MOVLW E8
1144 0395: MOVWF 74
1145 0396: MOVLW 01
1146 0397: MOVWF 7D
1147 0398: MOVLW F4
1148 0399: MOVWF 7C
1149 039A: CALL 05C
1150 .................... switch (movement) //vrat se zpet na caru
1151 .................... {
1152 039B: MOVF 45,W
1153 039C: XORLW 02
1154 039D: BTFSC 03.2
1155 039E: GOTO 3A6
1156 039F: XORLW 03
1157 03A0: BTFSC 03.2
1158 03A1: GOTO 3DE
1159 03A2: XORLW 02
1160 03A3: BTFSC 03.2
1161 03A4: GOTO 416
1162 03A5: GOTO 418
1163 .................... case L:
1164 .................... for (n=COUVANI;n>0;n--) {GO(R,B,speed_dira); Delay_ms(1);}
1165 03A6: MOVLW 02
1166 03A7: MOVWF 72
1167 03A8: MOVLW 58
1168 03A9: MOVWF 71
1169 03AA: MOVF 71,F
1170 03AB: BTFSS 03.2
1171 03AC: GOTO 3B0
1172 03AD: MOVF 72,F
1173 03AE: BTFSC 03.2
1174 03AF: GOTO 3CD
1175 03B0: MOVF 01,W
1176 03B1: SUBWF 73,W
1177 03B2: BTFSS 03.0
1178 03B3: GOTO 3BD
1179 03B4: BSF 03.5
1180 03B5: BCF 06.4
1181 03B6: BCF 03.5
1182 03B7: BCF 06.4
1183 03B8: BSF 03.5
1184 03B9: BCF 06.5
1185 03BA: BCF 03.5
1186 03BB: BSF 06.5
1187 03BC: GOTO 3C5
1188 03BD: BSF 03.5
1189 03BE: BCF 06.4
1190 03BF: BCF 03.5
1191 03C0: BCF 06.4
1192 03C1: BSF 03.5
1193 03C2: BCF 06.5
1194 03C3: BCF 03.5
1195 03C4: BCF 06.5
1196 03C5: MOVLW 01
1197 03C6: MOVWF 75
1198 03C7: CALL 088
1199 03C8: MOVF 71,W
1200 03C9: BTFSC 03.2
1201 03CA: DECF 72,F
1202 03CB: DECF 71,F
1203 03CC: GOTO 3AA
1204 .................... STOPL;STOPR;
1205 03CD: BSF 03.5
1206 03CE: BCF 06.6
1207 03CF: BCF 03.5
1208 03D0: BCF 06.6
1209 03D1: BSF 03.5
1210 03D2: BCF 06.7
1211 03D3: BCF 03.5
1212 03D4: BCF 06.7
1213 03D5: BSF 03.5
1214 03D6: BCF 06.4
1215 03D7: BCF 03.5
1216 03D8: BCF 06.4
1217 03D9: BSF 03.5
1218 03DA: BCF 06.5
1219 03DB: BCF 03.5
1220 03DC: BCF 06.5
1221 .................... break;
1222 03DD: GOTO 418
1223 .................... case R:
1224 .................... for (n=COUVANI;n>0;n--) {GO(L,B,speed_dira); Delay_ms(1);}
1225 03DE: MOVLW 02
1226 03DF: MOVWF 72
1227 03E0: MOVLW 58
1228 03E1: MOVWF 71
1229 03E2: MOVF 71,F
1230 03E3: BTFSS 03.2
1231 03E4: GOTO 3E8
1232 03E5: MOVF 72,F
1233 03E6: BTFSC 03.2
1234 03E7: GOTO 405
1235 03E8: MOVF 01,W
1236 03E9: SUBWF 73,W
1237 03EA: BTFSS 03.0
1238 03EB: GOTO 3F5
1239 03EC: BSF 03.5
1240 03ED: BCF 06.6
1241 03EE: BCF 03.5
1242 03EF: BCF 06.6
1243 03F0: BSF 03.5
1244 03F1: BCF 06.7
1245 03F2: BCF 03.5
1246 03F3: BSF 06.7
1247 03F4: GOTO 3FD
1248 03F5: BSF 03.5
1249 03F6: BCF 06.6
1250 03F7: BCF 03.5
1251 03F8: BCF 06.6
1252 03F9: BSF 03.5
1253 03FA: BCF 06.7
1254 03FB: BCF 03.5
1255 03FC: BCF 06.7
1256 03FD: MOVLW 01
1257 03FE: MOVWF 75
1258 03FF: CALL 088
1259 0400: MOVF 71,W
1260 0401: BTFSC 03.2
1261 0402: DECF 72,F
1262 0403: DECF 71,F
1263 0404: GOTO 3E2
1264 .................... STOPL;STOPR;
1265 0405: BSF 03.5
1266 0406: BCF 06.6
1267 0407: BCF 03.5
1268 0408: BCF 06.6
1269 0409: BSF 03.5
1270 040A: BCF 06.7
1271 040B: BCF 03.5
1272 040C: BCF 06.7
1273 040D: BSF 03.5
1274 040E: BCF 06.4
1275 040F: BCF 03.5
1276 0410: BCF 06.4
1277 0411: BSF 03.5
1278 0412: BCF 06.5
1279 0413: BCF 03.5
1280 0414: BCF 06.5
1281 .................... break;
1282 0415: GOTO 418
1283 .................... case S:
1284 .................... goto sem;
1285 0416: GOTO 4D2
1286 .................... break;
1287 0417: GOTO 418
1288 .................... }
1289 .................... beep(800,500);
1290 0418: MOVLW 03
1291 0419: MOVWF 75
1292 041A: MOVLW 20
1293 041B: MOVWF 74
1294 041C: MOVLW 01
1295 041D: MOVWF 7D
1296 041E: MOVLW F4
1297 041F: MOVWF 7C
1298 0420: CALL 05C
1299 ....................
1300 .................... line=0;
1301 0421: CLRF 41
1302 .................... FR; BL; Delay_ms(300); // otoc se na caru
1303 0422: BSF 03.5
1304 0423: BCF 06.5
1305 0424: BCF 03.5
1306 0425: BCF 06.5
1307 0426: BSF 03.5
1308 0427: BCF 06.4
1309 0428: BCF 03.5
1310 0429: BSF 06.4
1311 042A: BSF 03.5
1312 042B: BCF 06.6
1313 042C: BCF 03.5
1314 042D: BCF 06.6
1315 042E: BSF 03.5
1316 042F: BCF 06.7
1317 0430: BCF 03.5
1318 0431: BSF 06.7
1319 0432: MOVLW 02
1320 0433: MOVWF 74
1321 0434: MOVLW 96
1322 0435: MOVWF 75
1323 0436: CALL 088
1324 0437: DECFSZ 74,F
1325 0438: GOTO 434
1326 .................... while(line==0)
1327 .................... {
1328 0439: MOVF 41,F
1329 043A: BTFSS 03.2
1330 043B: GOTO 44D
1331 .................... line = RSENSOR; // cteni senzoru na caru
1332 043C: CLRF 41
1333 043D: BSF 03.5
1334 043E: BTFSS 1C.7
1335 043F: GOTO 443
1336 0440: BCF 03.5
1337 0441: INCF 41,F
1338 0442: BSF 03.5
1339 .................... line |= LSENSOR << 1;
1340 0443: MOVLW 00
1341 0444: BTFSC 1C.6
1342 0445: MOVLW 01
1343 0446: MOVWF 77
1344 0447: BCF 03.0
1345 0448: RLF 77,F
1346 0449: MOVF 77,W
1347 044A: BCF 03.5
1348 044B: IORWF 41,F
1349 .................... }
1350 044C: GOTO 439
1351 .................... FL;BR; Delay_ms(60);
1352 044D: BSF 03.5
1353 044E: BCF 06.7
1354 044F: BCF 03.5
1355 0450: BCF 06.7
1356 0451: BSF 03.5
1357 0452: BCF 06.6
1358 0453: BCF 03.5
1359 0454: BSF 06.6
1360 0455: BSF 03.5
1361 0456: BCF 06.4
1362 0457: BCF 03.5
1363 0458: BCF 06.4
1364 0459: BSF 03.5
1365 045A: BCF 06.5
1366 045B: BCF 03.5
1367 045C: BSF 06.5
1368 045D: MOVLW 3C
1369 045E: MOVWF 75
1370 045F: CALL 088
1371 .................... STOPL; STOPR;
1372 0460: BSF 03.5
1373 0461: BCF 06.6
1374 0462: BCF 03.5
1375 0463: BCF 06.6
1376 0464: BSF 03.5
1377 0465: BCF 06.7
1378 0466: BCF 03.5
1379 0467: BCF 06.7
1380 0468: BSF 03.5
1381 0469: BCF 06.4
1382 046A: BCF 03.5
1383 046B: BCF 06.4
1384 046C: BSF 03.5
1385 046D: BCF 06.5
1386 046E: BCF 03.5
1387 046F: BCF 06.5
1388 ....................
1389 .................... FL; BR; Delay_ms(500);
1390 0470: BSF 03.5
1391 0471: BCF 06.7
1392 0472: BCF 03.5
1393 0473: BCF 06.7
1394 0474: BSF 03.5
1395 0475: BCF 06.6
1396 0476: BCF 03.5
1397 0477: BSF 06.6
1398 0478: BSF 03.5
1399 0479: BCF 06.4
1400 047A: BCF 03.5
1401 047B: BCF 06.4
1402 047C: BSF 03.5
1403 047D: BCF 06.5
1404 047E: BCF 03.5
1405 047F: BSF 06.5
1406 0480: MOVLW 02
1407 0481: MOVWF 74
1408 0482: MOVLW FA
1409 0483: MOVWF 75
1410 0484: CALL 088
1411 0485: DECFSZ 74,F
1412 0486: GOTO 482
1413 .................... STOPL; STOPR;
1414 0487: BSF 03.5
1415 0488: BCF 06.6
1416 0489: BCF 03.5
1417 048A: BCF 06.6
1418 048B: BSF 03.5
1419 048C: BCF 06.7
1420 048D: BCF 03.5
1421 048E: BCF 06.7
1422 048F: BSF 03.5
1423 0490: BCF 06.4
1424 0491: BCF 03.5
1425 0492: BCF 06.4
1426 0493: BSF 03.5
1427 0494: BCF 06.5
1428 0495: BCF 03.5
1429 0496: BCF 06.5
1430 ....................
1431 .................... Delay_ms(1000);
1432 0497: MOVLW 04
1433 0498: MOVWF 74
1434 0499: MOVLW FA
1435 049A: MOVWF 75
1436 049B: CALL 088
1437 049C: DECFSZ 74,F
1438 049D: GOTO 499
1439 ....................
1440 .................... FR;FL; //popojed rovne
1441 049E: BSF 03.5
1442 049F: BCF 06.5
1443 04A0: BCF 03.5
1444 04A1: BCF 06.5
1445 04A2: BSF 03.5
1446 04A3: BCF 06.4
1447 04A4: BCF 03.5
1448 04A5: BSF 06.4
1449 04A6: BSF 03.5
1450 04A7: BCF 06.7
1451 04A8: BCF 03.5
1452 04A9: BCF 06.7
1453 04AA: BSF 03.5
1454 04AB: BCF 06.6
1455 04AC: BCF 03.5
1456 04AD: BSF 06.6
1457 .................... for(n=PRES_DIRU;n>0;n--)
1458 04AE: CLRF 72
1459 04AF: MOVLW FA
1460 04B0: MOVWF 71
1461 04B1: MOVF 71,F
1462 04B2: BTFSS 03.2
1463 04B3: GOTO 4B7
1464 04B4: MOVF 72,F
1465 04B5: BTFSC 03.2
1466 04B6: GOTO 4D2
1467 .................... {
1468 .................... line = RSENSOR; // cteni senzoru na caru
1469 04B7: CLRF 41
1470 04B8: BSF 03.5
1471 04B9: BTFSS 1C.7
1472 04BA: GOTO 4BE
1473 04BB: BCF 03.5
1474 04BC: INCF 41,F
1475 04BD: BSF 03.5
1476 .................... line |= LSENSOR << 1;
1477 04BE: MOVLW 00
1478 04BF: BTFSC 1C.6
1479 04C0: MOVLW 01
1480 04C1: MOVWF 77
1481 04C2: BCF 03.0
1482 04C3: RLF 77,F
1483 04C4: MOVF 77,W
1484 04C5: BCF 03.5
1485 04C6: IORWF 41,F
1486 .................... if (line!=0) break;
1487 04C7: MOVF 41,F
1488 04C8: BTFSS 03.2
1489 04C9: GOTO 4D2
1490 .................... Delay_ms(1);
1491 04CA: MOVLW 01
1492 04CB: MOVWF 75
1493 04CC: CALL 088
1494 .................... }
1495 04CD: MOVF 71,W
1496 04CE: BTFSC 03.2
1497 04CF: DECF 72,F
1498 04D0: DECF 71,F
1499 04D1: GOTO 4B1
1500 .................... sem:
1501 .................... STOPL; STOPR;
1502 04D2: BSF 03.5
1503 04D3: BCF 06.6
1504 04D4: BCF 03.5
1505 04D5: BCF 06.6
1506 04D6: BSF 03.5
1507 04D7: BCF 06.7
1508 04D8: BCF 03.5
1509 04D9: BCF 06.7
1510 04DA: BSF 03.5
1511 04DB: BCF 06.4
1512 04DC: BCF 03.5
1513 04DD: BCF 06.4
1514 04DE: BSF 03.5
1515 04DF: BCF 06.5
1516 04E0: BCF 03.5
1517 04E1: BCF 06.5
1518 .................... movement=S;
1519 04E2: MOVLW 03
1520 04E3: MOVWF 45
1521 .................... cikcak(); // najdi caru
1522 04E4: CALL 1FD
1523 .................... dira=0;
1524 04E5: CLRF 46
1525 .................... }
1526 04E6: BCF 0A.3
1527 04E7: GOTO 65C (RETURN)
1528 .................... ///////////////////////////////////////////////////////////////////////////////
1529 .................... void main()
1530 .................... {
1531 04E8: CLRF 04
1532 04E9: MOVLW 1F
1533 04EA: ANDWF 03,F
1534 04EB: BSF 03.5
1535 04EC: BCF 1F.4
1536 04ED: BCF 1F.5
1537 04EE: MOVF 1B,W
1538 04EF: ANDLW 80
1539 04F0: MOVWF 1B
1540 04F1: MOVLW 07
1541 04F2: MOVWF 1C
1542 04F3: MOVF 1C,W
1543 04F4: BCF 03.5
1544 04F5: BCF 0D.6
1545 04F6: MOVLW 60
1546 04F7: BSF 03.5
1547 04F8: MOVWF 0F
1548 .................... unsigned int16 n; // pro FOR
1549 ....................
1550 .................... STOPL; STOPR; // prepne vystupy na ovladani motoru na output a zastavi
1551 *
1552 0515: BSF 03.5
1553 0516: BCF 06.6
1554 0517: BCF 03.5
1555 0518: BCF 06.6
1556 0519: BSF 03.5
1557 051A: BCF 06.7
1558 051B: BCF 03.5
1559 051C: BCF 06.7
1560 051D: BSF 03.5
1561 051E: BCF 06.4
1562 051F: BCF 03.5
1563 0520: BCF 06.4
1564 0521: BSF 03.5
1565 0522: BCF 06.5
1566 0523: BCF 03.5
1567 0524: BCF 06.5
1568 ....................
1569 .................... setup_oscillator(OSC_4MHZ|OSC_INTRC); // 4 MHz interni RC oscilator
1570 0525: MOVLW 62
1571 0526: BSF 03.5
1572 0527: MOVWF 0F
1573 ....................
1574 .................... port_b_pullups(TRUE); // pullups pro piano na diagnostiku
1575 0528: BCF 01.7
1576 .................... setup_spi(FALSE);
1577 0529: BCF 03.5
1578 052A: BCF 14.5
1579 052B: BSF 03.5
1580 052C: BCF 06.2
1581 052D: BSF 06.1
1582 052E: BCF 06.4
1583 052F: MOVLW 00
1584 0530: BCF 03.5
1585 0531: MOVWF 14
1586 0532: BSF 03.5
1587 0533: MOVWF 14
1588 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); // Casovac pro PWM
1589 0534: MOVF 01,W
1590 0535: ANDLW C7
1591 0536: IORLW 08
1592 0537: MOVWF 01
1593 ....................
1594 .................... setup_timer_2(T2_DIV_BY_4,255,10); // Casovac pro regulaci
1595 0538: MOVLW 48
1596 0539: MOVWF 78
1597 053A: IORLW 05
1598 053B: BCF 03.5
1599 053C: MOVWF 12
1600 053D: MOVLW FF
1601 053E: BSF 03.5
1602 053F: MOVWF 12
1603 .................... // preruseni kazdych 10ms
1604 .................... setup_adc_ports(sAN2|VSS_VDD); // nastaveni A/D prevodniku pro naraznik
1605 0540: BCF 1F.4
1606 0541: BCF 1F.5
1607 0542: MOVF 1B,W
1608 0543: ANDLW 80
1609 0544: IORLW 04
1610 0545: MOVWF 1B
1611 .................... setup_adc(ADC_CLOCK_INTERNAL);
1612 0546: BCF 1F.6
1613 0547: BCF 03.5
1614 0548: BSF 1F.6
1615 0549: BSF 1F.7
1616 054A: BSF 03.5
1617 054B: BCF 1F.7
1618 054C: BCF 03.5
1619 054D: BSF 1F.0
1620 .................... set_adc_channel(2);
1621 054E: MOVLW 10
1622 054F: MOVWF 78
1623 0550: MOVF 1F,W
1624 0551: ANDLW C7
1625 0552: IORWF 78,W
1626 0553: MOVWF 1F
1627 .................... setup_timer_1(T1_INTERNAL|T1_DIV_BY_1); // Casovac pro naraznik
1628 0554: MOVLW 85
1629 0555: MOVWF 10
1630 .................... setup_ccp1(CCP_COMPARE_RESET_TIMER);
1631 0556: BSF 03.5
1632 0557: BSF 06.3
1633 0558: MOVLW 0B
1634 0559: BCF 03.5
1635 055A: MOVWF 17
1636 .................... CCP_1=(2^10)-1; // prevod kazdou 1ms
1637 055B: CLRF 16
1638 055C: MOVLW 07
1639 055D: MOVWF 15
1640 ....................
1641 .................... setup_comparator(A0_VR_A1_VR); // inicializace komparatoru pro cidla cary
1642 055E: MOVLW 02
1643 055F: BSF 03.5
1644 0560: MOVWF 1C
1645 0561: MOVF 05,W
1646 0562: IORLW 03
1647 0563: MOVWF 05
1648 0564: MOVLW 03
1649 0565: MOVWF 77
1650 0566: DECFSZ 77,F
1651 0567: GOTO 566
1652 0568: MOVF 1C,W
1653 0569: BCF 03.5
1654 056A: BCF 0D.6
1655 .................... setup_vref(VREF_HIGH|TRESHOLD); // 32 kroku od 0.25 do 0.75 Vdd
1656 056B: MOVLW 8A
1657 056C: BSF 03.5
1658 056D: MOVWF 1D
1659 ....................
1660 .................... Beep(1000,200); //double beep
1661 056E: MOVLW 03
1662 056F: MOVWF 75
1663 0570: MOVLW E8
1664 0571: MOVWF 74
1665 0572: CLRF 7D
1666 0573: MOVLW C8
1667 0574: MOVWF 7C
1668 0575: BCF 03.5
1669 0576: CALL 05C
1670 .................... Delay_ms(50);
1671 0577: MOVLW 32
1672 0578: MOVWF 75
1673 0579: CALL 088
1674 .................... Beep(1000,200);
1675 057A: MOVLW 03
1676 057B: MOVWF 75
1677 057C: MOVLW E8
1678 057D: MOVWF 74
1679 057E: CLRF 7D
1680 057F: MOVLW C8
1681 0580: MOVWF 7C
1682 0581: CALL 05C
1683 .................... Delay_ms(1000); // 1s
1684 0582: MOVLW 04
1685 0583: MOVWF 71
1686 0584: MOVLW FA
1687 0585: MOVWF 75
1688 0586: CALL 088
1689 0587: DECFSZ 71,F
1690 0588: GOTO 584
1691 ....................
1692 .................... // povoleni rizeni rychlosti zataceni pres preruseni
1693 .................... enable_interrupts(INT_TIMER2);
1694 0589: BSF 03.5
1695 058A: BSF 0C.1
1696 .................... enable_interrupts(GLOBAL);
1697 058B: MOVLW C0
1698 058C: BCF 03.5
1699 058D: IORWF 0B,F
1700 ....................
1701 .................... /*---------------------------------------------------------------------------*/
1702 .................... sensors=S;
1703 058E: MOVLW 03
1704 058F: MOVWF 40
1705 .................... line=S;
1706 0590: MOVWF 41
1707 .................... last=S;
1708 0591: MOVWF 44
1709 .................... movement=S;
1710 0592: MOVWF 45
1711 .................... speed=FW_POMALU;
1712 0593: MOVLW E6
1713 0594: MOVWF 42
1714 ....................
1715 .................... diagnostika();
1716 0595: GOTO 09D
1717 .................... // cikcak(); // toc se, abys nasel caru
1718 .................... Delay_ms(500);
1719 0596: MOVLW 02
1720 0597: MOVWF 71
1721 0598: MOVLW FA
1722 0599: MOVWF 75
1723 059A: CALL 088
1724 059B: DECFSZ 71,F
1725 059C: GOTO 598
1726 .................... Beep(1000,200);
1727 059D: MOVLW 03
1728 059E: MOVWF 75
1729 059F: MOVLW E8
1730 05A0: MOVWF 74
1731 05A1: CLRF 7D
1732 05A2: MOVLW C8
1733 05A3: MOVWF 7C
1734 05A4: CALL 05C
1735 .................... Delay_ms(500);
1736 05A5: MOVLW 02
1737 05A6: MOVWF 71
1738 05A7: MOVLW FA
1739 05A8: MOVWF 75
1740 05A9: CALL 088
1741 05AA: DECFSZ 71,F
1742 05AB: GOTO 5A7
1743 ....................
1744 .................... while(true) // hlavni smycka (jizda podle cary)
1745 .................... {
1746 .................... sensors = RSENSOR; // cteni senzoru na caru
1747 05AC: CLRF 40
1748 05AD: BSF 03.5
1749 05AE: BTFSS 1C.7
1750 05AF: GOTO 5B3
1751 05B0: BCF 03.5
1752 05B1: INCF 40,F
1753 05B2: BSF 03.5
1754 .................... sensors |= LSENSOR << 1;
1755 05B3: MOVLW 00
1756 05B4: BTFSC 1C.6
1757 05B5: MOVLW 01
1758 05B6: MOVWF 77
1759 05B7: BCF 03.0
1760 05B8: RLF 77,F
1761 05B9: MOVF 77,W
1762 05BA: BCF 03.5
1763 05BB: IORWF 40,F
1764 ....................
1765 .................... if ((read_adc(ADC_READ_ONLY)<BUMPER_TRESHOLD) && (dira<=T_CIHLA)) objizdka();
1766 05BC: BTFSC 1F.2
1767 05BD: GOTO 5BC
1768 05BE: MOVF 1E,W
1769 05BF: SUBLW 7F
1770 05C0: BTFSS 03.0
1771 05C1: GOTO 5C6
1772 05C2: MOVF 46,W
1773 05C3: SUBLW 32
1774 05C4: BTFSC 03.0
1775 05C5: GOTO 289
1776 ....................
1777 .................... switch (sensors) // zatacej podle toho, kde vidis caru
1778 .................... {
1779 05C6: MOVF 40,W
1780 05C7: XORLW 03
1781 05C8: BTFSC 03.2
1782 05C9: GOTO 5D1
1783 05CA: XORLW 01
1784 05CB: BTFSC 03.2
1785 05CC: GOTO 5E5
1786 05CD: XORLW 03
1787 05CE: BTFSC 03.2
1788 05CF: GOTO 61E
1789 05D0: GOTO 657
1790 .................... case S: // rovne
1791 .................... FL; FR; // pokud se jede dlouho rovne, tak pridej
1792 05D1: BSF 03.5
1793 05D2: BCF 06.7
1794 05D3: BCF 03.5
1795 05D4: BCF 06.7
1796 05D5: BSF 03.5
1797 05D6: BCF 06.6
1798 05D7: BCF 03.5
1799 05D8: BSF 06.6
1800 05D9: BSF 03.5
1801 05DA: BCF 06.5
1802 05DB: BCF 03.5
1803 05DC: BCF 06.5
1804 05DD: BSF 03.5
1805 05DE: BCF 06.4
1806 05DF: BCF 03.5
1807 05E0: BSF 06.4
1808 .................... dira=0;
1809 05E1: CLRF 46
1810 .................... movement=S;
1811 05E2: MOVLW 03
1812 05E3: MOVWF 45
1813 .................... continue;
1814 05E4: GOTO 5AC
1815 .................... case L: // trochu vlevo
1816 .................... GO(L, F, FW_POMALU+rovinka); GO(R, F, FW_STREDNE+rovinka);
1817 05E5: MOVF 01,W
1818 05E6: MOVWF 71
1819 05E7: MOVLW E6
1820 05E8: ADDWF 43,W
1821 05E9: SUBWF 71,W
1822 05EA: BTFSC 03.2
1823 05EB: GOTO 5EE
1824 05EC: BTFSC 03.0
1825 05ED: GOTO 5F7
1826 05EE: BSF 03.5
1827 05EF: BCF 06.7
1828 05F0: BCF 03.5
1829 05F1: BCF 06.7
1830 05F2: BSF 03.5
1831 05F3: BCF 06.6
1832 05F4: BCF 03.5
1833 05F5: BSF 06.6
1834 05F6: GOTO 5FF
1835 05F7: BSF 03.5
1836 05F8: BCF 06.6
1837 05F9: BCF 03.5
1838 05FA: BCF 06.6
1839 05FB: BSF 03.5
1840 05FC: BCF 06.7
1841 05FD: BCF 03.5
1842 05FE: BCF 06.7
1843 05FF: MOVF 01,W
1844 0600: MOVWF 71
1845 0601: MOVLW F0
1846 0602: ADDWF 43,W
1847 0603: SUBWF 71,W
1848 0604: BTFSC 03.2
1849 0605: GOTO 608
1850 0606: BTFSC 03.0
1851 0607: GOTO 611
1852 0608: BSF 03.5
1853 0609: BCF 06.5
1854 060A: BCF 03.5
1855 060B: BCF 06.5
1856 060C: BSF 03.5
1857 060D: BCF 06.4
1858 060E: BCF 03.5
1859 060F: BSF 06.4
1860 0610: GOTO 619
1861 0611: BSF 03.5
1862 0612: BCF 06.4
1863 0613: BCF 03.5
1864 0614: BCF 06.4
1865 0615: BSF 03.5
1866 0616: BCF 06.5
1867 0617: BCF 03.5
1868 0618: BCF 06.5
1869 .................... line=L;
1870 0619: MOVLW 02
1871 061A: MOVWF 41
1872 .................... dira=0;
1873 061B: CLRF 46
1874 .................... movement=L;
1875 061C: MOVWF 45
1876 .................... continue;
1877 061D: GOTO 5AC
1878 .................... case R: // trochu vpravo
1879 .................... GO(R, F, FW_POMALU+rovinka); GO(L, F, FW_STREDNE+rovinka);
1880 061E: MOVF 01,W
1881 061F: MOVWF 71
1882 0620: MOVLW E6
1883 0621: ADDWF 43,W
1884 0622: SUBWF 71,W
1885 0623: BTFSC 03.2
1886 0624: GOTO 627
1887 0625: BTFSC 03.0
1888 0626: GOTO 630
1889 0627: BSF 03.5
1890 0628: BCF 06.5
1891 0629: BCF 03.5
1892 062A: BCF 06.5
1893 062B: BSF 03.5
1894 062C: BCF 06.4
1895 062D: BCF 03.5
1896 062E: BSF 06.4
1897 062F: GOTO 638
1898 0630: BSF 03.5
1899 0631: BCF 06.4
1900 0632: BCF 03.5
1901 0633: BCF 06.4
1902 0634: BSF 03.5
1903 0635: BCF 06.5
1904 0636: BCF 03.5
1905 0637: BCF 06.5
1906 0638: MOVF 01,W
1907 0639: MOVWF 71
1908 063A: MOVLW F0
1909 063B: ADDWF 43,W
1910 063C: SUBWF 71,W
1911 063D: BTFSC 03.2
1912 063E: GOTO 641
1913 063F: BTFSC 03.0
1914 0640: GOTO 64A
1915 0641: BSF 03.5
1916 0642: BCF 06.7
1917 0643: BCF 03.5
1918 0644: BCF 06.7
1919 0645: BSF 03.5
1920 0646: BCF 06.6
1921 0647: BCF 03.5
1922 0648: BSF 06.6
1923 0649: GOTO 652
1924 064A: BSF 03.5
1925 064B: BCF 06.6
1926 064C: BCF 03.5
1927 064D: BCF 06.6
1928 064E: BSF 03.5
1929 064F: BCF 06.7
1930 0650: BCF 03.5
1931 0651: BCF 06.7
1932 .................... line=R;
1933 0652: MOVLW 01
1934 0653: MOVWF 41
1935 .................... dira=0;
1936 0654: CLRF 46
1937 .................... movement=R;
1938 0655: MOVWF 45
1939 .................... continue;
1940 0656: GOTO 5AC
1941 .................... default: // kdyz jsou obe cidla mimo caru, tak pokracuj dal
1942 .................... }
1943 .................... rovinka=0;
1944 0657: CLRF 43
1945 .................... if (dira>=T_DIRA) prejeddiru();
1946 0658: MOVF 46,W
1947 0659: SUBLW 56
1948 065A: BTFSS 03.0
1949 065B: GOTO 380
1950 .................... if (last!=line) // pokud si prejel caru z jedne strany na druhou stranu, tak zabrzdi
1951 065C: MOVF 41,W
1952 065D: SUBWF 44,W
1953 065E: BTFSC 03.2
1954 065F: GOTO 664
1955 .................... {
1956 .................... last=line;
1957 0660: MOVF 41,W
1958 0661: MOVWF 44
1959 .................... speed=FW_ZATACKA;
1960 0662: MOVLW C8
1961 0663: MOVWF 42
1962 .................... }
1963 .................... if (L==line) // kdyz jsou obe cidla mimo caru, zatoc na caru
1964 0664: MOVF 41,W
1965 0665: SUBLW 02
1966 0666: BTFSS 03.2
1967 0667: GOTO 688
1968 .................... {
1969 .................... STOPL;
1970 0668: BSF 03.5
1971 0669: BCF 06.6
1972 066A: BCF 03.5
1973 066B: BCF 06.6
1974 066C: BSF 03.5
1975 066D: BCF 06.7
1976 066E: BCF 03.5
1977 066F: BCF 06.7
1978 .................... GO(R, F, speed);
1979 0670: MOVF 01,W
1980 0671: SUBWF 42,W
1981 0672: BTFSS 03.0
1982 0673: GOTO 67D
1983 0674: BSF 03.5
1984 0675: BCF 06.5
1985 0676: BCF 03.5
1986 0677: BCF 06.5
1987 0678: BSF 03.5
1988 0679: BCF 06.4
1989 067A: BCF 03.5
1990 067B: BSF 06.4
1991 067C: GOTO 685
1992 067D: BSF 03.5
1993 067E: BCF 06.4
1994 067F: BCF 03.5
1995 0680: BCF 06.4
1996 0681: BSF 03.5
1997 0682: BCF 06.5
1998 0683: BCF 03.5
1999 0684: BCF 06.5
2000 .................... movement=L;
2001 0685: MOVLW 02
2002 0686: MOVWF 45
2003 .................... }
2004 .................... else
2005 0687: GOTO 6A7
2006 .................... {
2007 .................... STOPR;
2008 0688: BSF 03.5
2009 0689: BCF 06.4
2010 068A: BCF 03.5
2011 068B: BCF 06.4
2012 068C: BSF 03.5
2013 068D: BCF 06.5
2014 068E: BCF 03.5
2015 068F: BCF 06.5
2016 .................... GO(L, F, speed);
2017 0690: MOVF 01,W
2018 0691: SUBWF 42,W
2019 0692: BTFSS 03.0
2020 0693: GOTO 69D
2021 0694: BSF 03.5
2022 0695: BCF 06.7
2023 0696: BCF 03.5
2024 0697: BCF 06.7
2025 0698: BSF 03.5
2026 0699: BCF 06.6
2027 069A: BCF 03.5
2028 069B: BSF 06.6
2029 069C: GOTO 6A5
2030 069D: BSF 03.5
2031 069E: BCF 06.6
2032 069F: BCF 03.5
2033 06A0: BCF 06.6
2034 06A1: BSF 03.5
2035 06A2: BCF 06.7
2036 06A3: BCF 03.5
2037 06A4: BCF 06.7
2038 .................... movement=R;
2039 06A5: MOVLW 01
2040 06A6: MOVWF 45
2041 .................... }
2042 .................... } // while(true)
2043 06A7: GOTO 5AC
2044 .................... }
2045 ....................
2046 ....................
2047 06A8: SLEEP
2048  
2049 Configuration Fuses:
2050 Word 1: 3F38 NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
2051 Word 2: 3FFC NOFCMEN NOIESO