Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
2 kaklik 1
CCS PCM C Compiler, Version 3.245, 27853               25-IV-06 20:23
2
 
3
               Filename: D:\KAKLIK\programy\PIC_C\roboti\3Orbis\main.lst
4
 
5
               ROM used: 1149 words (28%)
6
                         Largest free fragment is 2048
7
               RAM used: 32 (18%) at main() level
8
                         35 (20%) worst case
9
               Stack:    5 worst case (3 in main + 2 for interrupts)
10
 
11
*
12
0000:  MOVLW  00
13
0001:  MOVWF  0A
14
0002:  GOTO   261
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   047
67
.................... #include ".\main.h" 
68
.................... #include <16F88.h> 
69
.................... //////// Standard Header file for the PIC16F88 device //////////////// 
70
.................... #device PIC16F88 
71
.................... #list 
72
....................  
73
.................... #device adc=8 
74
....................  
75
.................... #FUSES NOWDT                 	//No Watch Dog Timer 
76
.................... #FUSES INTRC_IO 
77
.................... #FUSES NOPUT                 	//No Power Up Timer 
78
.................... #FUSES MCLR                  	//Master Clear pin enabled 
79
.................... #FUSES NOBROWNOUT             //Reset when brownout detected 
80
.................... #FUSES NOLVP                  //Low Voltage Programming on B3(PIC16) or B5(PIC18) 
81
.................... #FUSES NOCPD                 	//No EE protection 
82
.................... #FUSES NOWRT                 	//Program memory not write protected 
83
.................... #FUSES NODEBUG               	//No Debug mode for ICD 
84
.................... #FUSES NOPROTECT             	//Code not protected from reading 
85
.................... #FUSES NOFCMEN                //Fail-safe clock monitor enabled 
86
.................... #FUSES NOIESO                  	//Internal External Switch Over mode enabled 
87
....................  
88
.................... #use delay(clock=8000000,RESTART_WDT) 
89
0037:  MOVLW  08
90
0038:  SUBWF  3D,F
91
0039:  BTFSS  03.0
92
003A:  GOTO   046
93
003B:  MOVLW  3D
94
003C:  MOVWF  04
95
003D:  BCF    03.0
96
003E:  RRF    00,F
97
003F:  MOVF   00,W
98
0040:  BTFSC  03.2
99
0041:  GOTO   046
100
0042:  GOTO   044
101
0043:  CLRWDT
102
0044:  DECFSZ 00,F
103
0045:  GOTO   043
104
0046:  RETLW  00
105
*
106
0065:  MOVLW  3A
107
0066:  MOVWF  04
108
0067:  MOVF   00,W
109
0068:  BTFSC  03.2
110
0069:  GOTO   07C
111
006A:  MOVLW  02
112
006B:  MOVWF  78
113
006C:  MOVLW  BF
114
006D:  MOVWF  77
115
006E:  CLRWDT
116
006F:  DECFSZ 77,F
117
0070:  GOTO   06E
118
0071:  DECFSZ 78,F
119
0072:  GOTO   06C
120
0073:  MOVLW  96
121
0074:  MOVWF  77
122
0075:  DECFSZ 77,F
123
0076:  GOTO   075
124
0077:  NOP
125
0078:  NOP
126
0079:  CLRWDT
127
007A:  DECFSZ 00,F
128
007B:  GOTO   06A
129
007C:  RETLW  00
130
....................  
131
....................  
132
....................  
133
.................... #define  KOLMO1      225         // predni kolecko sroubem dopredu 
134
.................... #define  KOLMO2      30          // predni kolecko je hlavou sroubu dozadu 
135
.................... #define  STRED       128         // sredni poloha zataceciho kolecka 
136
.................... #define  BEAR1       10//10          // 3 stupne zataceni 
137
.................... #define  BEAR2       25//25 
138
.................... #define  BEAR3       45//45 
139
.................... #define  R           100         // Rozumna rychlost 
140
.................... #define  R17         200         // X nasobek rozumne rychlosti 
141
.................... //#define  L1            1     // cara vlevo 
142
.................... #define  L2            2     // cara vlevo 
143
.................... #define  L3            3     // cara vlevo 
144
.................... #define  S             0     // cara mezi sensory 
145
.................... //#define  R1           -1     // cara vpravo 
146
.................... #define  R2           -2     // cara vpravo 
147
.................... #define  R3           -3     // cara vpravo 
148
....................  
149
.................... // servo 
150
.................... #define  SERVO PIN_B5 
151
....................  
152
.................... // kroutitka 
153
.................... #define  CERVENA  4  // AN4 
154
.................... //#define  CERNA    5  // AN5 
155
.................... //#define  ZELENA   6  // AN6 
156
.................... #define  MODRA    2  // AN2 
157
....................  
158
.................... // IR 
159
.................... #define IRTX      PIN_B2 
160
.................... #define  CIHLA    PIN_A3 
161
....................  
162
.................... //motory 
163
.................... #define  FR         output_low(PIN_A7); output_high(PIN_A6)  // Vpred 
164
.................... #define  FL         output_low(PIN_A1); output_high(PIN_A0) 
165
.................... #define  BR         output_low(PIN_A6); output_high(PIN_A7)  // Vzad 
166
.................... #define  BL         output_low(PIN_A0); output_high(PIN_A1) 
167
.................... #define  STOPR      output_low(PIN_A6);output_low(PIN_A7) 
168
.................... #define  STOPL      output_low(PIN_A0);output_low(PIN_A1) 
169
....................  
170
.................... //HID 
171
.................... #define  LED1     PIN_B1      //oranzova 
172
.................... #define  LED2     PIN_B2      //zluta 
173
....................  
174
.................... #define  STROBE   PIN_B0 
175
.................... //#define  SW1      PIN_A2      // Motory On/off 
176
....................  
177
.................... unsigned int8 sensors;        // pomocna promenna pro cteni cidel na caru 
178
.................... signed int8 line = S;         // na ktere strane byla detekovana cara 
179
*
180
026E:  BCF    03.5
181
026F:  CLRF   2B
182
.................... //unsigned int8 dira;         // pocita dobu po kterou je ztracena cara 
183
.................... unsigned int8 uhel;           // urcuje aktualni uhel zataceni 
184
.................... unsigned int8 speed;          // maximalni povolena rychlost 
185
.................... unsigned int8 turn;           // rychlost toceni 
186
.................... unsigned int8 rovinka;        // pocitadlo na zjisteni rovinky 
187
....................  
188
.................... signed int16  Lmotor;         // promene, ktere urcuji velikost vykonu na levem 
189
.................... signed int16  Rmotor;         // a pravem motoru 
190
....................  
191
.................... // makro pro PWM pro motory 
192
.................... #define GO(motor, direction, power) if(get_timer0()<=power) \ 
193
.................... {direction##motor;} else {stop##motor;} 
194
.................... //////////////////////////////////////////////////////////////////////////////// 
195
.................... #int_TIMER2 
196
.................... TIMER2_isr()      // ovladani serva 
197
.................... { 
198
....................    unsigned int8 n; 
199
....................  
200
....................    output_high(SERVO); 
201
*
202
0047:  BSF    03.5
203
0048:  BCF    06.5
204
0049:  BCF    03.5
205
004A:  BSF    06.5
206
....................    delay_us(1000); 
207
004B:  CLRWDT
208
004C:  MOVLW  09
209
004D:  MOVWF  3C
210
004E:  MOVLW  6D
211
004F:  MOVWF  3D
212
0050:  CALL   037
213
0051:  DECFSZ 3C,F
214
0052:  GOTO   04E
215
....................    for(n=uhel; n>0; n--) Delay_us(2); 
216
0053:  MOVF   2C,W
217
0054:  MOVWF  3B
218
0055:  MOVF   3B,F
219
0056:  BTFSC  03.2
220
0057:  GOTO   05E
221
0058:  CLRWDT
222
0059:  NOP
223
005A:  NOP
224
005B:  NOP
225
005C:  DECF   3B,F
226
005D:  GOTO   055
227
....................    output_low(SERVO); 
228
005E:  BSF    03.5
229
005F:  BCF    06.5
230
0060:  BCF    03.5
231
0061:  BCF    06.5
232
.................... } 
233
....................  
234
.................... //////////////////////////////////////////////////////////////////////////////// 
235
0062:  BCF    0C.1
236
0063:  BCF    0A.3
237
0064:  GOTO   022
238
.................... short int IRcheck()                 // potvrdi detekci cihly 
239
.................... { 
240
....................    output_high(IRTX);               // vypne vysilac IR 
241
....................    delay_ms(100); 
242
....................  
243
....................    output_low(STROBE); 
244
....................    sensors = spi_read(0);         // cteni senzoru 
245
....................    sensors=~sensors; 
246
....................    output_high(STROBE); 
247
....................  
248
....................    if(true==bit_test(sensors,7))    // otestuje, jestli je stale detekovan IR signal 
249
....................    { 
250
....................       output_low(IRTX);             // zapne vysilac IR 
251
....................       delay_ms(100); 
252
....................  
253
....................       output_low(STROBE); 
254
....................       sensors = spi_read(0);         // cteni senzoru 
255
....................       sensors=~sensors; 
256
....................       output_high(STROBE); 
257
....................  
258
....................       if(false==bit_test(sensors,7))      // otestuje, jestli je detekovana cihla 
259
....................       { 
260
....................          output_high(IRTX);            // vypne vysilac IR 
261
....................          delay_ms(100); 
262
....................  
263
....................          output_low(STROBE); 
264
....................          sensors = spi_read(0);         // cteni senzoru 
265
....................          sensors=~sensors; 
266
....................          output_high(STROBE); 
267
....................  
268
....................          output_low(IRTX);             // zapne vysilac IR 
269
....................          if(bit_test(sensors,7)) return 1; // vrat 1, kdyz je stale cihla 
270
....................       } 
271
....................    }; 
272
....................    output_low(IRTX);             // zapne vysilac IR 
273
....................    return 0; // vrat 0, kdyz je detekovano ruseni 
274
.................... } 
275
.................... //////////////////////////////////////////////////////////////////////////////// 
276
.................... #include ".\objizdka_centrovani.c" 
277
.................... #define  DOLEVA   0 
278
.................... #define  DOPRAVA  1 
279
....................  
280
.................... void cikcak() 
281
.................... { 
282
.................... unsigned int8 i; 
283
....................  
284
....................    uhel=KOLMO1; 
285
*
286
007D:  MOVLW  E1
287
007E:  MOVWF  2C
288
....................    Delay_ms(100); 
289
007F:  MOVLW  64
290
0080:  MOVWF  3A
291
0081:  CALL   065
292
....................    if (line==L2) line=L3; 
293
0082:  MOVF   2B,W
294
0083:  SUBLW  02
295
0084:  BTFSS  03.2
296
0085:  GOTO   088
297
0086:  MOVLW  03
298
0087:  MOVWF  2B
299
....................    if (line==S) line=L3; 
300
0088:  MOVF   2B,F
301
0089:  BTFSS  03.2
302
008A:  GOTO   08D
303
008B:  MOVLW  03
304
008C:  MOVWF  2B
305
....................    if (line==R2) line=R3; 
306
008D:  MOVF   2B,W
307
008E:  SUBLW  FE
308
008F:  BTFSS  03.2
309
0090:  GOTO   093
310
0091:  MOVLW  FD
311
0092:  MOVWF  2B
312
....................  
313
....................    Delay_ms(3); 
314
0093:  MOVLW  03
315
0094:  MOVWF  3A
316
0095:  CALL   065
317
....................  
318
....................    output_low(STROBE);              // vypni zobrazovani na posuvnem registru    
319
0096:  BSF    03.5
320
0097:  BCF    06.0
321
0098:  BCF    03.5
322
0099:  BCF    06.0
323
....................    sensors = spi_read(0);           // cteni senzoru 
324
009A:  MOVF   13,W
325
009B:  CLRF   13
326
009C:  BSF    03.5
327
009D:  BTFSC  14.0
328
009E:  GOTO   0A1
329
009F:  BCF    03.5
330
00A0:  GOTO   09C
331
00A1:  BCF    03.5
332
00A2:  MOVF   13,W
333
00A3:  MOVWF  2A
334
....................    sensors=~sensors; 
335
00A4:  COMF   2A,F
336
....................    output_high(STROBE);             // vypni zobrazovani na posuvnem registru 
337
00A5:  BSF    03.5
338
00A6:  BCF    06.0
339
00A7:  BCF    03.5
340
00A8:  BSF    06.0
341
....................  
342
....................    while(!bit_test(sensors,3)) 
343
....................    { 
344
00A9:  BTFSC  2A.3
345
00AA:  GOTO   171
346
....................       while(true) 
347
....................       { 
348
....................          Delay_ms(3); 
349
00AB:  MOVLW  03
350
00AC:  MOVWF  3A
351
00AD:  CALL   065
352
....................        
353
....................          if (line==L3) 
354
00AE:  MOVF   2B,W
355
00AF:  SUBLW  03
356
00B0:  BTFSS  03.2
357
00B1:  GOTO   0DC
358
....................          { 
359
....................             GO(L,B,160);GO(R,F,160); 
360
00B2:  MOVF   01,W
361
00B3:  SUBLW  A0
362
00B4:  BTFSS  03.0
363
00B5:  GOTO   0BF
364
00B6:  BSF    03.5
365
00B7:  BCF    05.0
366
00B8:  BCF    03.5
367
00B9:  BCF    05.0
368
00BA:  BSF    03.5
369
00BB:  BCF    05.1
370
00BC:  BCF    03.5
371
00BD:  BSF    05.1
372
00BE:  GOTO   0C7
373
00BF:  BSF    03.5
374
00C0:  BCF    05.0
375
00C1:  BCF    03.5
376
00C2:  BCF    05.0
377
00C3:  BSF    03.5
378
00C4:  BCF    05.1
379
00C5:  BCF    03.5
380
00C6:  BCF    05.1
381
00C7:  MOVF   01,W
382
00C8:  SUBLW  A0
383
00C9:  BTFSS  03.0
384
00CA:  GOTO   0D4
385
00CB:  BSF    03.5
386
00CC:  BCF    05.7
387
00CD:  BCF    03.5
388
00CE:  BCF    05.7
389
00CF:  BSF    03.5
390
00D0:  BCF    05.6
391
00D1:  BCF    03.5
392
00D2:  BSF    05.6
393
00D3:  GOTO   0DC
394
00D4:  BSF    03.5
395
00D5:  BCF    05.6
396
00D6:  BCF    03.5
397
00D7:  BCF    05.6
398
00D8:  BSF    03.5
399
00D9:  BCF    05.7
400
00DA:  BCF    03.5
401
00DB:  BCF    05.7
402
....................          }; 
403
....................          if (line==R3) 
404
00DC:  MOVF   2B,W
405
00DD:  SUBLW  FD
406
00DE:  BTFSS  03.2
407
00DF:  GOTO   10A
408
....................          { 
409
....................             GO(R,B,160);GO(L,F,160);    
410
00E0:  MOVF   01,W
411
00E1:  SUBLW  A0
412
00E2:  BTFSS  03.0
413
00E3:  GOTO   0ED
414
00E4:  BSF    03.5
415
00E5:  BCF    05.6
416
00E6:  BCF    03.5
417
00E7:  BCF    05.6
418
00E8:  BSF    03.5
419
00E9:  BCF    05.7
420
00EA:  BCF    03.5
421
00EB:  BSF    05.7
422
00EC:  GOTO   0F5
423
00ED:  BSF    03.5
424
00EE:  BCF    05.6
425
00EF:  BCF    03.5
426
00F0:  BCF    05.6
427
00F1:  BSF    03.5
428
00F2:  BCF    05.7
429
00F3:  BCF    03.5
430
00F4:  BCF    05.7
431
00F5:  MOVF   01,W
432
00F6:  SUBLW  A0
433
00F7:  BTFSS  03.0
434
00F8:  GOTO   102
435
00F9:  BSF    03.5
436
00FA:  BCF    05.1
437
00FB:  BCF    03.5
438
00FC:  BCF    05.1
439
00FD:  BSF    03.5
440
00FE:  BCF    05.0
441
00FF:  BCF    03.5
442
0100:  BSF    05.0
443
0101:  GOTO   10A
444
0102:  BSF    03.5
445
0103:  BCF    05.0
446
0104:  BCF    03.5
447
0105:  BCF    05.0
448
0106:  BSF    03.5
449
0107:  BCF    05.1
450
0108:  BCF    03.5
451
0109:  BCF    05.1
452
....................          }; 
453
....................          if (line==S) {STOPL;STOPR; i++;} 
454
010A:  MOVF   2B,F
455
010B:  BTFSS  03.2
456
010C:  GOTO   11F
457
010D:  BSF    03.5
458
010E:  BCF    05.0
459
010F:  BCF    03.5
460
0110:  BCF    05.0
461
0111:  BSF    03.5
462
0112:  BCF    05.1
463
0113:  BCF    03.5
464
0114:  BCF    05.1
465
0115:  BSF    03.5
466
0116:  BCF    05.6
467
0117:  BCF    03.5
468
0118:  BCF    05.6
469
0119:  BSF    03.5
470
011A:  BCF    05.7
471
011B:  BCF    03.5
472
011C:  BCF    05.7
473
011D:  INCF   39,F
474
....................          else i=0; 
475
011E:  GOTO   120
476
011F:  CLRF   39
477
....................           
478
....................          if (i>=100) break; 
479
0120:  MOVF   39,W
480
0121:  SUBLW  63
481
0122:  BTFSS  03.0
482
0123:  GOTO   15A
483
....................           
484
....................          output_low(STROBE);              // vypni zobrazovani na posuvnem registru    
485
0124:  BSF    03.5
486
0125:  BCF    06.0
487
0126:  BCF    03.5
488
0127:  BCF    06.0
489
....................          sensors = spi_read(0);         // cteni senzoru 
490
0128:  MOVF   13,W
491
0129:  CLRF   13
492
012A:  BSF    03.5
493
012B:  BTFSC  14.0
494
012C:  GOTO   12F
495
012D:  BCF    03.5
496
012E:  GOTO   12A
497
012F:  BCF    03.5
498
0130:  MOVF   13,W
499
0131:  MOVWF  2A
500
....................          sensors=~sensors; 
501
0132:  COMF   2A,F
502
....................          output_high(STROBE);              // vypni zobrazovani na posuvnem registru 
503
0133:  BSF    03.5
504
0134:  BCF    06.0
505
0135:  BCF    03.5
506
0136:  BSF    06.0
507
....................           
508
....................          if(bit_test(sensors,3)) //...|...// 
509
0137:  BTFSS  2A.3
510
0138:  GOTO   13B
511
....................          { 
512
....................             line=S; 
513
0139:  CLRF   2B
514
....................             continue; 
515
013A:  GOTO   0AB
516
....................          } 
517
....................     
518
....................          if(bit_test(sensors,0)) //|......//     // z duvodu zkraceni doby reakce se cidla nevyhodnocuji poporade ale od krajnich k prostrednimu 
519
013B:  BTFSS  2A.0
520
013C:  GOTO   140
521
....................          { 
522
....................             line=L3; 
523
013D:  MOVLW  03
524
013E:  MOVWF  2B
525
....................             continue; 
526
013F:  GOTO   0AB
527
....................          } 
528
....................     
529
....................          if(bit_test(sensors,6)) //......|// 
530
0140:  BTFSS  2A.6
531
0141:  GOTO   145
532
....................          { 
533
....................             line=R3; 
534
0142:  MOVLW  FD
535
0143:  MOVWF  2B
536
....................             continue; 
537
0144:  GOTO   0AB
538
....................          } 
539
....................     
540
....................          if(bit_test(sensors,1)) //.|.....// 
541
0145:  BTFSS  2A.1
542
0146:  GOTO   14A
543
....................          { 
544
....................             line=L3; 
545
0147:  MOVLW  03
546
0148:  MOVWF  2B
547
....................             continue; 
548
0149:  GOTO   0AB
549
....................          } 
550
....................     
551
....................          if(bit_test(sensors,5)) //.....|.// 
552
014A:  BTFSS  2A.5
553
014B:  GOTO   14F
554
....................          { 
555
....................             line=R3; 
556
014C:  MOVLW  FD
557
014D:  MOVWF  2B
558
....................             continue; 
559
014E:  GOTO   0AB
560
....................          } 
561
....................     
562
....................          if (bit_test(sensors,2)) //..|....// 
563
014F:  BTFSS  2A.2
564
0150:  GOTO   154
565
....................          { 
566
....................             line=L3; 
567
0151:  MOVLW  03
568
0152:  MOVWF  2B
569
....................             continue; 
570
0153:  GOTO   0AB
571
....................          } 
572
....................     
573
....................          if (bit_test(sensors,4)) //....|..// 
574
0154:  BTFSS  2A.4
575
0155:  GOTO   159
576
....................          { 
577
....................             line=R3; 
578
0156:  MOVLW  FD
579
0157:  MOVWF  2B
580
....................             continue; 
581
0158:  GOTO   0AB
582
....................          } 
583
....................       } 
584
0159:  GOTO   0AB
585
....................       delay_ms(100); 
586
015A:  MOVLW  64
587
015B:  MOVWF  3A
588
015C:  CALL   065
589
....................  
590
....................       output_low(STROBE);              // vypni zobrazovani na posuvnem registru    
591
015D:  BSF    03.5
592
015E:  BCF    06.0
593
015F:  BCF    03.5
594
0160:  BCF    06.0
595
....................       sensors = spi_read(0);         // cteni senzoru 
596
0161:  MOVF   13,W
597
0162:  CLRF   13
598
0163:  BSF    03.5
599
0164:  BTFSC  14.0
600
0165:  GOTO   168
601
0166:  BCF    03.5
602
0167:  GOTO   163
603
0168:  BCF    03.5
604
0169:  MOVF   13,W
605
016A:  MOVWF  2A
606
....................       sensors=~sensors; 
607
016B:  COMF   2A,F
608
....................       output_high(STROBE);              // vypni zobrazovani na posuvnem registru 
609
016C:  BSF    03.5
610
016D:  BCF    06.0
611
016E:  BCF    03.5
612
016F:  BSF    06.0
613
....................    }    
614
0170:  GOTO   0A9
615
.................... } 
616
0171:  RETLW  00
617
....................  
618
.................... /* 
619
.................... void cikcak() 
620
.................... { 
621
.................... short int movement; 
622
.................... unsigned int8 n,i=0; 
623
....................  
624
....................    if(uhel>=STRED) 
625
....................    { 
626
....................       uhel=KOLMO1; 
627
....................       Delay_ms(100); 
628
....................    } 
629
....................  
630
....................    if(uhel<=STRED) 
631
....................    { 
632
....................       uhel=KOLMO2; 
633
....................       Delay_ms(100); 
634
....................    } 
635
....................  
636
....................  
637
....................    sensors = spi_read(0);         // cteni senzoru 
638
....................    sensors=~sensors; 
639
....................    Delay_ms(5); 
640
....................     
641
.................... if ((sensors & 0b11100000)!=0) movement=DOPRAVA; 
642
....................  
643
....................    while(i<=100) 
644
....................    { 
645
....................       while(!bit_test(sensors,3)) 
646
....................       { 
647
....................          if(DOPRAVA == movement) 
648
....................          { 
649
....................             FR;BL; 
650
....................             movement=DOLEVA; 
651
....................             n=0; 
652
.................... //if ((sensors & 0b11100000)!=0) line=L1; 
653
.................... //if ((sensors & 0b00001110)!=0) line=R1; 
654
.................... //if ((sensors & 0b00010000)!=0) line=S; 
655
....................  
656
....................             for(n=0; n<=100; n++) 
657
....................             { 
658
....................                sensors = spi_read(0);         // cteni senzoru 
659
....................                sensors=~sensors; 
660
....................                Delay_ms(5);                     // cekani na SLAVE nez pripravi data od cidel 
661
....................                if(bit_test(sensors,3)) break; 
662
....................                else i=0; 
663
....................             } 
664
....................             STOPL;STOPR; 
665
....................          } 
666
....................  
667
....................          if(DOLEVA == movement) 
668
....................          { 
669
....................             FL;BR; 
670
....................             movement=DOPRAVA; 
671
....................             n=0; 
672
....................  
673
....................             for(n=0; n<=100; n++) 
674
....................             { 
675
....................                sensors = spi_read(0); 
676
....................                sensors =~ sensors; 
677
....................                Delay_ms(5); 
678
....................                if(bit_test(sensors,3)) break; 
679
....................                else i=0; 
680
....................             } 
681
....................             STOPL;STOPR; 
682
....................          } 
683
....................          sensors = spi_read(0);         // cteni senzoru 
684
....................          sensors=~sensors; 
685
....................          Delay_ms(5); 
686
....................       } 
687
....................       i++; 
688
....................    } 
689
.................... } 
690
.................... */ 
691
.................... //////////////////////////////////////////////////////////////////////////////// 
692
.................... void objizdka() 
693
.................... { 
694
....................    BL;FR; 
695
0172:  BSF    03.5
696
0173:  BCF    05.0
697
0174:  BCF    03.5
698
0175:  BCF    05.0
699
0176:  BSF    03.5
700
0177:  BCF    05.1
701
0178:  BCF    03.5
702
0179:  BSF    05.1
703
017A:  BSF    03.5
704
017B:  BCF    05.7
705
017C:  BCF    03.5
706
017D:  BCF    05.7
707
017E:  BSF    03.5
708
017F:  BCF    05.6
709
0180:  BCF    03.5
710
0181:  BSF    05.6
711
....................    Delay_ms(300); 
712
0182:  MOVLW  02
713
0183:  MOVWF  39
714
0184:  MOVLW  96
715
0185:  MOVWF  3A
716
0186:  CALL   065
717
0187:  DECFSZ 39,F
718
0188:  GOTO   184
719
....................    FL;BR; 
720
0189:  BSF    03.5
721
018A:  BCF    05.1
722
018B:  BCF    03.5
723
018C:  BCF    05.1
724
018D:  BSF    03.5
725
018E:  BCF    05.0
726
018F:  BCF    03.5
727
0190:  BSF    05.0
728
0191:  BSF    03.5
729
0192:  BCF    05.6
730
0193:  BCF    03.5
731
0194:  BCF    05.6
732
0195:  BSF    03.5
733
0196:  BCF    05.7
734
0197:  BCF    03.5
735
0198:  BSF    05.7
736
....................    Delay_ms(100); 
737
0199:  MOVLW  64
738
019A:  MOVWF  3A
739
019B:  CALL   065
740
....................    STOPL;STOPR; 
741
019C:  BSF    03.5
742
019D:  BCF    05.0
743
019E:  BCF    03.5
744
019F:  BCF    05.0
745
01A0:  BSF    03.5
746
01A1:  BCF    05.1
747
01A2:  BCF    03.5
748
01A3:  BCF    05.1
749
01A4:  BSF    03.5
750
01A5:  BCF    05.6
751
01A6:  BCF    03.5
752
01A7:  BCF    05.6
753
01A8:  BSF    03.5
754
01A9:  BCF    05.7
755
01AA:  BCF    03.5
756
01AB:  BCF    05.7
757
....................     
758
....................    uhel=STRED; 
759
01AC:  MOVLW  80
760
01AD:  MOVWF  2C
761
....................    FL;FR; 
762
01AE:  BSF    03.5
763
01AF:  BCF    05.1
764
01B0:  BCF    03.5
765
01B1:  BCF    05.1
766
01B2:  BSF    03.5
767
01B3:  BCF    05.0
768
01B4:  BCF    03.5
769
01B5:  BSF    05.0
770
01B6:  BSF    03.5
771
01B7:  BCF    05.7
772
01B8:  BCF    03.5
773
01B9:  BCF    05.7
774
01BA:  BSF    03.5
775
01BB:  BCF    05.6
776
01BC:  BCF    03.5
777
01BD:  BSF    05.6
778
....................    Delay_ms(500);       // rovne 
779
01BE:  MOVLW  02
780
01BF:  MOVWF  39
781
01C0:  MOVLW  FA
782
01C1:  MOVWF  3A
783
01C2:  CALL   065
784
01C3:  DECFSZ 39,F
785
01C4:  GOTO   1C0
786
....................  
787
....................    uhel=STRED+55; 
788
01C5:  MOVLW  B7
789
01C6:  MOVWF  2C
790
....................    STOPR;FL; 
791
01C7:  BSF    03.5
792
01C8:  BCF    05.6
793
01C9:  BCF    03.5
794
01CA:  BCF    05.6
795
01CB:  BSF    03.5
796
01CC:  BCF    05.7
797
01CD:  BCF    03.5
798
01CE:  BCF    05.7
799
01CF:  BSF    03.5
800
01D0:  BCF    05.1
801
01D1:  BCF    03.5
802
01D2:  BCF    05.1
803
01D3:  BSF    03.5
804
01D4:  BCF    05.0
805
01D5:  BCF    03.5
806
01D6:  BSF    05.0
807
....................    Delay_ms(190);       // doprava 
808
01D7:  MOVLW  BE
809
01D8:  MOVWF  3A
810
01D9:  CALL   065
811
....................  
812
....................    uhel=STRED; 
813
01DA:  MOVLW  80
814
01DB:  MOVWF  2C
815
....................    FR;FL; 
816
01DC:  BSF    03.5
817
01DD:  BCF    05.7
818
01DE:  BCF    03.5
819
01DF:  BCF    05.7
820
01E0:  BSF    03.5
821
01E1:  BCF    05.6
822
01E2:  BCF    03.5
823
01E3:  BSF    05.6
824
01E4:  BSF    03.5
825
01E5:  BCF    05.1
826
01E6:  BCF    03.5
827
01E7:  BCF    05.1
828
01E8:  BSF    03.5
829
01E9:  BCF    05.0
830
01EA:  BCF    03.5
831
01EB:  BSF    05.0
832
....................    Delay_ms(500);       // rovne 
833
01EC:  MOVLW  02
834
01ED:  MOVWF  39
835
01EE:  MOVLW  FA
836
01EF:  MOVWF  3A
837
01F0:  CALL   065
838
01F1:  DECFSZ 39,F
839
01F2:  GOTO   1EE
840
....................  
841
....................    uhel=STRED+55; 
842
01F3:  MOVLW  B7
843
01F4:  MOVWF  2C
844
....................    FL;STOPR; 
845
01F5:  BSF    03.5
846
01F6:  BCF    05.1
847
01F7:  BCF    03.5
848
01F8:  BCF    05.1
849
01F9:  BSF    03.5
850
01FA:  BCF    05.0
851
01FB:  BCF    03.5
852
01FC:  BSF    05.0
853
01FD:  BSF    03.5
854
01FE:  BCF    05.6
855
01FF:  BCF    03.5
856
0200:  BCF    05.6
857
0201:  BSF    03.5
858
0202:  BCF    05.7
859
0203:  BCF    03.5
860
0204:  BCF    05.7
861
....................    Delay_ms(200);       // doprava 
862
0205:  MOVLW  C8
863
0206:  MOVWF  3A
864
0207:  CALL   065
865
....................  
866
....................    uhel=STRED; 
867
0208:  MOVLW  80
868
0209:  MOVWF  2C
869
....................    FR;FL; 
870
020A:  BSF    03.5
871
020B:  BCF    05.7
872
020C:  BCF    03.5
873
020D:  BCF    05.7
874
020E:  BSF    03.5
875
020F:  BCF    05.6
876
0210:  BCF    03.5
877
0211:  BSF    05.6
878
0212:  BSF    03.5
879
0213:  BCF    05.1
880
0214:  BCF    03.5
881
0215:  BCF    05.1
882
0216:  BSF    03.5
883
0217:  BCF    05.0
884
0218:  BCF    03.5
885
0219:  BSF    05.0
886
....................    Delay_ms(150);       // rovne 
887
021A:  MOVLW  96
888
021B:  MOVWF  3A
889
021C:  CALL   065
890
....................  
891
....................    While((sensors & 0b11111110)!=0) //dokud neni cara 
892
....................    { 
893
021D:  MOVF   2A,W
894
021E:  ANDLW  FE
895
021F:  BTFSC  03.2
896
0220:  GOTO   230
897
....................        sensors = spi_read(0);         // cteni senzoru 
898
0221:  MOVF   13,W
899
0222:  CLRF   13
900
0223:  BSF    03.5
901
0224:  BTFSC  14.0
902
0225:  GOTO   228
903
0226:  BCF    03.5
904
0227:  GOTO   223
905
0228:  BCF    03.5
906
0229:  MOVF   13,W
907
022A:  MOVWF  2A
908
....................        sensors=~sensors; 
909
022B:  COMF   2A,F
910
....................        Delay_ms(4);              // cekani na SLAVE nez pripravi data od cidel 
911
022C:  MOVLW  04
912
022D:  MOVWF  3A
913
022E:  CALL   065
914
....................    } 
915
022F:  GOTO   21D
916
....................    BL;BR; 
917
0230:  BSF    03.5
918
0231:  BCF    05.0
919
0232:  BCF    03.5
920
0233:  BCF    05.0
921
0234:  BSF    03.5
922
0235:  BCF    05.1
923
0236:  BCF    03.5
924
0237:  BSF    05.1
925
0238:  BSF    03.5
926
0239:  BCF    05.6
927
023A:  BCF    03.5
928
023B:  BCF    05.6
929
023C:  BSF    03.5
930
023D:  BCF    05.7
931
023E:  BCF    03.5
932
023F:  BSF    05.7
933
....................    Delay_ms(400); 
934
0240:  MOVLW  02
935
0241:  MOVWF  39
936
0242:  MOVLW  C8
937
0243:  MOVWF  3A
938
0244:  CALL   065
939
0245:  DECFSZ 39,F
940
0246:  GOTO   242
941
....................     
942
....................    uhel=STRED-55; 
943
0247:  MOVLW  49
944
0248:  MOVWF  2C
945
....................    FR;STOPL;         // doleva 
946
0249:  BSF    03.5
947
024A:  BCF    05.7
948
024B:  BCF    03.5
949
024C:  BCF    05.7
950
024D:  BSF    03.5
951
024E:  BCF    05.6
952
024F:  BCF    03.5
953
0250:  BSF    05.6
954
0251:  BSF    03.5
955
0252:  BCF    05.0
956
0253:  BCF    03.5
957
0254:  BCF    05.0
958
0255:  BSF    03.5
959
0256:  BCF    05.1
960
0257:  BCF    03.5
961
0258:  BCF    05.1
962
....................    delay_ms(250); 
963
0259:  MOVLW  FA
964
025A:  MOVWF  3A
965
025B:  CALL   065
966
....................     
967
....................    line=L3; 
968
025C:  MOVLW  03
969
025D:  MOVWF  2B
970
....................    cikcak(); 
971
025E:  CALL   07D
972
.................... } 
973
025F:  BCF    0A.3
974
0260:  GOTO   3D2 (RETURN)
975
....................   
976
....................  
977
.................... //////////////////////////////////////////////////////////////////////////////// 
978
.................... void main() 
979
.................... { 
980
0261:  CLRF   04
981
0262:  MOVLW  1F
982
0263:  ANDWF  03,F
983
0264:  MOVLW  70
984
0265:  BSF    03.5
985
0266:  MOVWF  0F
986
0267:  BCF    1F.4
987
0268:  BCF    1F.5
988
0269:  MOVF   1B,W
989
026A:  ANDLW  80
990
026B:  MOVWF  1B
991
026C:  MOVLW  07
992
026D:  MOVWF  1C
993
....................  
994
....................    unsigned int8 n; 
995
....................    unsigned int8 i,j; 
996
....................    unsigned int8 last_sensors; 
997
....................    unsigned int8 RozumnaRychlost; 
998
....................  
999
....................    setup_adc_ports(sAN5|sAN2|sAN4|sAN6|VSS_VDD); // AD pro kroutitka 
1000
*
1001
0270:  BSF    03.5
1002
0271:  BCF    1F.4
1003
0272:  BCF    1F.5
1004
0273:  MOVF   1B,W
1005
0274:  ANDLW  80
1006
0275:  IORLW  74
1007
0276:  MOVWF  1B
1008
....................    setup_adc(ADC_CLOCK_INTERNAL); 
1009
0277:  BCF    1F.6
1010
0278:  BCF    03.5
1011
0279:  BSF    1F.6
1012
027A:  BSF    1F.7
1013
027B:  BSF    03.5
1014
027C:  BCF    1F.7
1015
027D:  BCF    03.5
1016
027E:  BSF    1F.0
1017
....................    setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_16); 
1018
027F:  BCF    14.5
1019
0280:  BSF    03.5
1020
0281:  BCF    06.2
1021
0282:  BSF    06.1
1022
0283:  BCF    06.4
1023
0284:  MOVLW  31
1024
0285:  BCF    03.5
1025
0286:  MOVWF  14
1026
0287:  MOVLW  00
1027
0288:  BSF    03.5
1028
0289:  MOVWF  14
1029
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 
1030
028A:  MOVF   01,W
1031
028B:  ANDLW  C7
1032
028C:  IORLW  08
1033
028D:  MOVWF  01
1034
....................    setup_timer_1(T1_DISABLED|T1_DIV_BY_8); 
1035
028E:  MOVLW  30
1036
028F:  BCF    03.5
1037
0290:  MOVWF  10
1038
....................    setup_timer_2(T2_DIV_BY_16,140,16); 
1039
0291:  MOVLW  78
1040
0292:  MOVWF  78
1041
0293:  IORLW  06
1042
0294:  MOVWF  12
1043
0295:  MOVLW  8C
1044
0296:  BSF    03.5
1045
0297:  MOVWF  12
1046
....................    setup_oscillator(OSC_8MHZ|OSC_INTRC); 
1047
0298:  MOVLW  72
1048
0299:  MOVWF  0F
1049
....................  
1050
....................    STOPR; STOPL;  // zastav motory 
1051
029A:  BCF    05.6
1052
029B:  BCF    03.5
1053
029C:  BCF    05.6
1054
029D:  BSF    03.5
1055
029E:  BCF    05.7
1056
029F:  BCF    03.5
1057
02A0:  BCF    05.7
1058
02A1:  BSF    03.5
1059
02A2:  BCF    05.0
1060
02A3:  BCF    03.5
1061
02A4:  BCF    05.0
1062
02A5:  BSF    03.5
1063
02A6:  BCF    05.1
1064
02A7:  BCF    03.5
1065
02A8:  BCF    05.1
1066
....................    Lmotor=0;Rmotor=0; 
1067
02A9:  CLRF   31
1068
02AA:  CLRF   30
1069
02AB:  CLRF   33
1070
02AC:  CLRF   32
1071
....................  
1072
....................    uhel = STRED;    // nastav zadni kolecko na stred 
1073
02AD:  MOVLW  80
1074
02AE:  MOVWF  2C
1075
....................    rovinka = 0; 
1076
02AF:  CLRF   2F
1077
....................  
1078
....................    enable_interrupts(INT_TIMER2); 
1079
02B0:  BSF    03.5
1080
02B1:  BSF    0C.1
1081
....................    enable_interrupts(GLOBAL); 
1082
02B2:  MOVLW  C0
1083
02B3:  BCF    03.5
1084
02B4:  IORWF  0B,F
1085
....................  
1086
....................    output_low(IRTX); // zapni IR vysilac 
1087
02B5:  BSF    03.5
1088
02B6:  BCF    06.2
1089
02B7:  BCF    03.5
1090
02B8:  BCF    06.2
1091
....................  
1092
....................    delay_ms(2000); // musime pockat na diagnostiku slave CPU 
1093
02B9:  MOVLW  08
1094
02BA:  MOVWF  39
1095
02BB:  MOVLW  FA
1096
02BC:  MOVWF  3A
1097
02BD:  CALL   065
1098
02BE:  DECFSZ 39,F
1099
02BF:  GOTO   2BB
1100
....................  
1101
....................    //nastaveni rychlosti 
1102
....................    set_adc_channel(CERVENA); 
1103
02C0:  MOVLW  20
1104
02C1:  MOVWF  78
1105
02C2:  MOVF   1F,W
1106
02C3:  ANDLW  C7
1107
02C4:  IORWF  78,W
1108
02C5:  MOVWF  1F
1109
....................  
1110
....................    Delay_ms(1); 
1111
02C6:  MOVLW  01
1112
02C7:  MOVWF  3A
1113
02C8:  CALL   065
1114
....................    speed=R+(read_adc()>>2); // rychlost rovne +63; kroutitko dava 0-63 
1115
02C9:  BSF    1F.2
1116
02CA:  BTFSC  1F.2
1117
02CB:  GOTO   2CA
1118
02CC:  MOVF   1E,W
1119
02CD:  MOVWF  77
1120
02CE:  RRF    77,F
1121
02CF:  RRF    77,F
1122
02D0:  MOVLW  3F
1123
02D1:  ANDWF  77,F
1124
02D2:  MOVF   77,W
1125
02D3:  ADDLW  64
1126
02D4:  MOVWF  2D
1127
....................    set_adc_channel(MODRA); 
1128
02D5:  MOVLW  10
1129
02D6:  MOVWF  78
1130
02D7:  MOVF   1F,W
1131
02D8:  ANDLW  C7
1132
02D9:  IORWF  78,W
1133
02DA:  MOVWF  1F
1134
....................    Delay_ms(1); 
1135
02DB:  MOVLW  01
1136
02DC:  MOVWF  3A
1137
02DD:  CALL   065
1138
....................    turn=speed-32+(read_adc()>>2);  // rychlost toceni +-32; kroutitko dava 0-63 
1139
02DE:  MOVLW  20
1140
02DF:  SUBWF  2D,W
1141
02E0:  MOVWF  39
1142
02E1:  BSF    1F.2
1143
02E2:  BTFSC  1F.2
1144
02E3:  GOTO   2E2
1145
02E4:  MOVF   1E,W
1146
02E5:  MOVWF  77
1147
02E6:  RRF    77,F
1148
02E7:  RRF    77,F
1149
02E8:  MOVLW  3F
1150
02E9:  ANDWF  77,F
1151
02EA:  MOVF   77,W
1152
02EB:  ADDWF  39,W
1153
02EC:  MOVWF  2E
1154
....................  
1155
....................    RozumnaRychlost=speed; 
1156
02ED:  MOVF   2D,W
1157
02EE:  MOVWF  38
1158
....................     
1159
....................    while(true) 
1160
....................    { 
1161
....................  
1162
....................       GO(L,F,Lmotor);GO(R,F,Rmotor);   // zapni motory PWM podle promenych Lmotor a Rmotor 
1163
02EF:  MOVF   01,W
1164
02F0:  BTFSS  00.7
1165
02F1:  GOTO   2F5
1166
02F2:  BTFSS  31.7
1167
02F3:  GOTO   2FD
1168
02F4:  GOTO   2F7
1169
02F5:  BTFSC  31.7
1170
02F6:  GOTO   306
1171
02F7:  MOVF   31,F
1172
02F8:  BTFSS  03.2
1173
02F9:  GOTO   2FD
1174
02FA:  SUBWF  30,W
1175
02FB:  BTFSS  03.0
1176
02FC:  GOTO   306
1177
02FD:  BSF    03.5
1178
02FE:  BCF    05.1
1179
02FF:  BCF    03.5
1180
0300:  BCF    05.1
1181
0301:  BSF    03.5
1182
0302:  BCF    05.0
1183
0303:  BCF    03.5
1184
0304:  BSF    05.0
1185
0305:  GOTO   30E
1186
0306:  BSF    03.5
1187
0307:  BCF    05.0
1188
0308:  BCF    03.5
1189
0309:  BCF    05.0
1190
030A:  BSF    03.5
1191
030B:  BCF    05.1
1192
030C:  BCF    03.5
1193
030D:  BCF    05.1
1194
030E:  MOVF   01,W
1195
030F:  BTFSS  00.7
1196
0310:  GOTO   314
1197
0311:  BTFSS  33.7
1198
0312:  GOTO   31C
1199
0313:  GOTO   316
1200
0314:  BTFSC  33.7
1201
0315:  GOTO   325
1202
0316:  MOVF   33,F
1203
0317:  BTFSS  03.2
1204
0318:  GOTO   31C
1205
0319:  SUBWF  32,W
1206
031A:  BTFSS  03.0
1207
031B:  GOTO   325
1208
031C:  BSF    03.5
1209
031D:  BCF    05.7
1210
031E:  BCF    03.5
1211
031F:  BCF    05.7
1212
0320:  BSF    03.5
1213
0321:  BCF    05.6
1214
0322:  BCF    03.5
1215
0323:  BSF    05.6
1216
0324:  GOTO   32D
1217
0325:  BSF    03.5
1218
0326:  BCF    05.6
1219
0327:  BCF    03.5
1220
0328:  BCF    05.6
1221
0329:  BSF    03.5
1222
032A:  BCF    05.7
1223
032B:  BCF    03.5
1224
032C:  BCF    05.7
1225
....................  
1226
....................       delay_us(2000);                  // cekani na SLAVE, nez pripravi data od cidel 
1227
032D:  CLRWDT
1228
032E:  MOVLW  01
1229
032F:  MOVWF  3A
1230
0330:  CALL   065
1231
0331:  MOVLW  09
1232
0332:  MOVWF  39
1233
0333:  CLRF   29
1234
0334:  BTFSC  0B.7
1235
0335:  BSF    29.7
1236
0336:  BCF    0B.7
1237
0337:  MOVLW  6D
1238
0338:  MOVWF  3D
1239
0339:  CALL   037
1240
033A:  BTFSC  29.7
1241
033B:  BSF    0B.7
1242
033C:  DECFSZ 39,F
1243
033D:  GOTO   333
1244
....................  
1245
....................       last_sensors=sensors; 
1246
033E:  MOVF   2A,W
1247
033F:  MOVWF  37
1248
....................  
1249
....................       output_low(STROBE);              // vypni zobrazovani na posuvnem registru 
1250
0340:  BSF    03.5
1251
0341:  BCF    06.0
1252
0342:  BCF    03.5
1253
0343:  BCF    06.0
1254
....................       sensors = spi_read(0);           // cteni senzoru 
1255
0344:  MOVF   13,W
1256
0345:  CLRF   13
1257
0346:  BSF    03.5
1258
0347:  BTFSC  14.0
1259
0348:  GOTO   34B
1260
0349:  BCF    03.5
1261
034A:  GOTO   346
1262
034B:  BCF    03.5
1263
034C:  MOVF   13,W
1264
034D:  MOVWF  2A
1265
....................       sensors=~sensors;                // neguj prijata data 
1266
034E:  COMF   2A,F
1267
....................       output_high(STROBE);       // zobraz data na posuvnem registru 
1268
034F:  BSF    03.5
1269
0350:  BCF    06.0
1270
0351:  BCF    03.5
1271
0352:  BSF    06.0
1272
....................  
1273
....................       i=0;                       // havarijni kod 
1274
0353:  CLRF   35
1275
....................       for (n=0; n<=6; n++) 
1276
0354:  CLRF   34
1277
0355:  MOVF   34,W
1278
0356:  SUBLW  06
1279
0357:  BTFSS  03.0
1280
0358:  GOTO   367
1281
....................       { 
1282
....................          if(bit_test(sensors,n)) i++; 
1283
0359:  MOVF   2A,W
1284
035A:  MOVWF  77
1285
035B:  MOVF   34,W
1286
035C:  MOVWF  78
1287
035D:  BTFSC  03.2
1288
035E:  GOTO   363
1289
035F:  BCF    03.0
1290
0360:  RRF    77,F
1291
0361:  DECFSZ 78,F
1292
0362:  GOTO   35F
1293
0363:  BTFSC  77.0
1294
0364:  INCF   35,F
1295
....................       } 
1296
0365:  INCF   34,F
1297
0366:  GOTO   355
1298
....................       if (i>3) // zastavi, kdyz je cerno pod vice nez tremi cidly 
1299
0367:  MOVF   35,W
1300
0368:  SUBLW  03
1301
0369:  BTFSC  03.0
1302
036A:  GOTO   393
1303
....................       { 
1304
....................          BL; BR; 
1305
036B:  BSF    03.5
1306
036C:  BCF    05.0
1307
036D:  BCF    03.5
1308
036E:  BCF    05.0
1309
036F:  BSF    03.5
1310
0370:  BCF    05.1
1311
0371:  BCF    03.5
1312
0372:  BSF    05.1
1313
0373:  BSF    03.5
1314
0374:  BCF    05.6
1315
0375:  BCF    03.5
1316
0376:  BCF    05.6
1317
0377:  BSF    03.5
1318
0378:  BCF    05.7
1319
0379:  BCF    03.5
1320
037A:  BSF    05.7
1321
....................          delay_ms(300); 
1322
037B:  MOVLW  02
1323
037C:  MOVWF  39
1324
037D:  MOVLW  96
1325
037E:  MOVWF  3A
1326
037F:  CALL   065
1327
0380:  DECFSZ 39,F
1328
0381:  GOTO   37D
1329
....................          STOPR; STOPL; 
1330
0382:  BSF    03.5
1331
0383:  BCF    05.6
1332
0384:  BCF    03.5
1333
0385:  BCF    05.6
1334
0386:  BSF    03.5
1335
0387:  BCF    05.7
1336
0388:  BCF    03.5
1337
0389:  BCF    05.7
1338
038A:  BSF    03.5
1339
038B:  BCF    05.0
1340
038C:  BCF    03.5
1341
038D:  BCF    05.0
1342
038E:  BSF    03.5
1343
038F:  BCF    05.1
1344
0390:  BCF    03.5
1345
0391:  BCF    05.1
1346
....................          While(true); 
1347
0392:  GOTO   392
1348
....................       }; 
1349
....................  
1350
....................       if (!input(CIHLA))      // dalkova detekce cihly 
1351
0393:  BSF    03.5
1352
0394:  BSF    05.3
1353
0395:  BCF    03.5
1354
0396:  BTFSC  05.3
1355
0397:  GOTO   39B
1356
....................       { 
1357
....................          speed=100; 
1358
0398:  MOVLW  64
1359
0399:  MOVWF  2D
1360
....................       } 
1361
....................       else 
1362
039A:  GOTO   39D
1363
....................       { 
1364
....................          speed=RozumnaRychlost; 
1365
039B:  MOVF   38,W
1366
039C:  MOVWF  2D
1367
....................       } 
1368
....................        
1369
....................       if (bit_test(sensors,7))    // detekce cihly 
1370
039D:  BTFSS  2A.7
1371
039E:  GOTO   3D2
1372
....................       { 
1373
....................          BR;BL; 
1374
039F:  BSF    03.5
1375
03A0:  BCF    05.6
1376
03A1:  BCF    03.5
1377
03A2:  BCF    05.6
1378
03A3:  BSF    03.5
1379
03A4:  BCF    05.7
1380
03A5:  BCF    03.5
1381
03A6:  BSF    05.7
1382
03A7:  BSF    03.5
1383
03A8:  BCF    05.0
1384
03A9:  BCF    03.5
1385
03AA:  BCF    05.0
1386
03AB:  BSF    03.5
1387
03AC:  BCF    05.1
1388
03AD:  BCF    03.5
1389
03AE:  BSF    05.1
1390
....................          Delay_ms(400); 
1391
03AF:  MOVLW  02
1392
03B0:  MOVWF  39
1393
03B1:  MOVLW  C8
1394
03B2:  MOVWF  3A
1395
03B3:  CALL   065
1396
03B4:  DECFSZ 39,F
1397
03B5:  GOTO   3B1
1398
....................          STOPR;STOPL; 
1399
03B6:  BSF    03.5
1400
03B7:  BCF    05.6
1401
03B8:  BCF    03.5
1402
03B9:  BCF    05.6
1403
03BA:  BSF    03.5
1404
03BB:  BCF    05.7
1405
03BC:  BCF    03.5
1406
03BD:  BCF    05.7
1407
03BE:  BSF    03.5
1408
03BF:  BCF    05.0
1409
03C0:  BCF    03.5
1410
03C1:  BCF    05.0
1411
03C2:  BSF    03.5
1412
03C3:  BCF    05.1
1413
03C4:  BCF    03.5
1414
03C5:  BCF    05.1
1415
....................          Delay_ms(100); 
1416
03C6:  MOVLW  64
1417
03C7:  MOVWF  3A
1418
03C8:  CALL   065
1419
....................          cikcak(); 
1420
03C9:  CALL   07D
1421
....................          delay_ms(500); 
1422
03CA:  MOVLW  02
1423
03CB:  MOVWF  39
1424
03CC:  MOVLW  FA
1425
03CD:  MOVWF  3A
1426
03CE:  CALL   065
1427
03CF:  DECFSZ 39,F
1428
03D0:  GOTO   3CC
1429
....................          objizdka();       // objede cihlu 
1430
03D1:  GOTO   172
1431
....................       } 
1432
....................  
1433
....................  
1434
....................       if(bit_test(sensors,3)) //...|...// 
1435
03D2:  BTFSS  2A.3
1436
03D3:  GOTO   3E6
1437
....................       { 
1438
....................          uhel=STRED; 
1439
03D4:  MOVLW  80
1440
03D5:  MOVWF  2C
1441
....................          Lmotor=speed; 
1442
03D6:  CLRF   7A
1443
03D7:  MOVF   2D,W
1444
03D8:  MOVWF  30
1445
03D9:  MOVF   7A,W
1446
03DA:  MOVWF  31
1447
....................          Rmotor=speed; 
1448
03DB:  CLRF   7A
1449
03DC:  MOVF   2D,W
1450
03DD:  MOVWF  32
1451
03DE:  MOVF   7A,W
1452
03DF:  MOVWF  33
1453
....................          line=S; 
1454
03E0:  CLRF   2B
1455
....................          if (rovinka < 255) rovinka++; 
1456
03E1:  INCFSZ 2F,W
1457
03E2:  GOTO   3E4
1458
03E3:  GOTO   3E5
1459
03E4:  INCF   2F,F
1460
.................... //         if (speed > R) speed--; 
1461
....................          continue; 
1462
03E5:  GOTO   2EF
1463
....................       } 
1464
....................  
1465
....................       if(bit_test(sensors,0)) //|......//     // z duvodu zkraceni doby reakce se cidla nevyhodnocuji poporade ale od krajnich k prostrednimu 
1466
03E6:  BTFSS  2A.0
1467
03E7:  GOTO   3F4
1468
....................       { 
1469
....................          uhel=STRED - BEAR3; 
1470
03E8:  MOVLW  53
1471
03E9:  MOVWF  2C
1472
....................          Lmotor=0; 
1473
03EA:  CLRF   31
1474
03EB:  CLRF   30
1475
....................          Rmotor=turn; 
1476
03EC:  CLRF   7A
1477
03ED:  MOVF   2E,W
1478
03EE:  MOVWF  32
1479
03EF:  MOVF   7A,W
1480
03F0:  MOVWF  33
1481
....................          line=L3; 
1482
03F1:  MOVLW  03
1483
03F2:  MOVWF  2B
1484
.................... //         if (speed > R) speed--; 
1485
....................          continue; 
1486
03F3:  GOTO   2EF
1487
....................       } 
1488
....................  
1489
....................       if(bit_test(sensors,6)) //......|// 
1490
03F4:  BTFSS  2A.6
1491
03F5:  GOTO   402
1492
....................       { 
1493
....................          uhel=STRED + BEAR3; 
1494
03F6:  MOVLW  AD
1495
03F7:  MOVWF  2C
1496
....................          Rmotor=0; 
1497
03F8:  CLRF   33
1498
03F9:  CLRF   32
1499
....................          Lmotor=turn; 
1500
03FA:  CLRF   7A
1501
03FB:  MOVF   2E,W
1502
03FC:  MOVWF  30
1503
03FD:  MOVF   7A,W
1504
03FE:  MOVWF  31
1505
....................          line=R3; 
1506
03FF:  MOVLW  FD
1507
0400:  MOVWF  2B
1508
.................... //         if (speed > R) speed--; 
1509
....................          continue; 
1510
0401:  GOTO   2EF
1511
....................       } 
1512
....................  
1513
....................       if(bit_test(sensors,1)) //.|.....// 
1514
0402:  BTFSS  2A.1
1515
0403:  GOTO   414
1516
....................       { 
1517
....................          uhel=STRED - BEAR2; 
1518
0404:  MOVLW  67
1519
0405:  MOVWF  2C
1520
....................          Lmotor=speed-50; 
1521
0406:  MOVLW  32
1522
0407:  SUBWF  2D,W
1523
0408:  CLRF   7A
1524
0409:  MOVWF  30
1525
040A:  MOVF   7A,W
1526
040B:  MOVWF  31
1527
....................          Rmotor=speed; 
1528
040C:  CLRF   7A
1529
040D:  MOVF   2D,W
1530
040E:  MOVWF  32
1531
040F:  MOVF   7A,W
1532
0410:  MOVWF  33
1533
....................          line=L2; 
1534
0411:  MOVLW  02
1535
0412:  MOVWF  2B
1536
.................... //         if (speed > R) speed--; 
1537
....................          continue; 
1538
0413:  GOTO   2EF
1539
....................       } 
1540
....................  
1541
....................       if(bit_test(sensors,5)) //.....|.// 
1542
0414:  BTFSS  2A.5
1543
0415:  GOTO   426
1544
....................       { 
1545
....................          uhel=STRED + BEAR2; 
1546
0416:  MOVLW  99
1547
0417:  MOVWF  2C
1548
....................          Rmotor=speed-50; 
1549
0418:  MOVLW  32
1550
0419:  SUBWF  2D,W
1551
041A:  CLRF   7A
1552
041B:  MOVWF  32
1553
041C:  MOVF   7A,W
1554
041D:  MOVWF  33
1555
....................          Lmotor=speed; 
1556
041E:  CLRF   7A
1557
041F:  MOVF   2D,W
1558
0420:  MOVWF  30
1559
0421:  MOVF   7A,W
1560
0422:  MOVWF  31
1561
....................          line=R2; 
1562
0423:  MOVLW  FE
1563
0424:  MOVWF  2B
1564
.................... //         if (speed > R) speed--; 
1565
....................          continue; 
1566
0425:  GOTO   2EF
1567
....................       } 
1568
....................  
1569
....................       if (bit_test(sensors,2)) //..|....// 
1570
0426:  BTFSS  2A.2
1571
0427:  GOTO   43B
1572
....................       { 
1573
....................          uhel=STRED - BEAR1; 
1574
0428:  MOVLW  76
1575
0429:  MOVWF  2C
1576
....................          Lmotor=speed; 
1577
042A:  CLRF   7A
1578
042B:  MOVF   2D,W
1579
042C:  MOVWF  30
1580
042D:  MOVF   7A,W
1581
042E:  MOVWF  31
1582
....................          Rmotor=speed; 
1583
042F:  CLRF   7A
1584
0430:  MOVF   2D,W
1585
0431:  MOVWF  32
1586
0432:  MOVF   7A,W
1587
0433:  MOVWF  33
1588
....................          line=L2; 
1589
0434:  MOVLW  02
1590
0435:  MOVWF  2B
1591
....................          if (rovinka<255) rovinka++; 
1592
0436:  INCFSZ 2F,W
1593
0437:  GOTO   439
1594
0438:  GOTO   43A
1595
0439:  INCF   2F,F
1596
.................... //         if (speed > R) speed--; 
1597
....................          continue; 
1598
043A:  GOTO   2EF
1599
....................       } 
1600
....................  
1601
....................       if (bit_test(sensors,4)) //....|..// 
1602
043B:  BTFSS  2A.4
1603
043C:  GOTO   450
1604
....................       { 
1605
....................          uhel=STRED + BEAR1; 
1606
043D:  MOVLW  8A
1607
043E:  MOVWF  2C
1608
....................          Rmotor=speed; 
1609
043F:  CLRF   7A
1610
0440:  MOVF   2D,W
1611
0441:  MOVWF  32
1612
0442:  MOVF   7A,W
1613
0443:  MOVWF  33
1614
....................          Lmotor=speed; 
1615
0444:  CLRF   7A
1616
0445:  MOVF   2D,W
1617
0446:  MOVWF  30
1618
0447:  MOVF   7A,W
1619
0448:  MOVWF  31
1620
....................          line=L2; 
1621
0449:  MOVLW  02
1622
044A:  MOVWF  2B
1623
....................          if (rovinka<255) rovinka++; 
1624
044B:  INCFSZ 2F,W
1625
044C:  GOTO   44E
1626
044D:  GOTO   44F
1627
044E:  INCF   2F,F
1628
.................... //         if (speed > R) speed--; 
1629
....................          continue; 
1630
044F:  GOTO   2EF
1631
....................       } 
1632
....................  
1633
....................  
1634
....................       if ((L3==line) || (R3==line)) // Brzdeni pri vyjeti z trate 
1635
0450:  MOVF   2B,W
1636
0451:  SUBLW  03
1637
0452:  BTFSC  03.2
1638
0453:  GOTO   458
1639
0454:  MOVF   2B,W
1640
0455:  SUBLW  FD
1641
0456:  BTFSS  03.2
1642
0457:  GOTO   47B
1643
....................       { 
1644
....................          if (rovinka>50) 
1645
0458:  MOVF   2F,W
1646
0459:  SUBLW  32
1647
045A:  BTFSC  03.0
1648
045B:  GOTO   47A
1649
....................          { 
1650
....................             BL; BR; 
1651
045C:  BSF    03.5
1652
045D:  BCF    05.0
1653
045E:  BCF    03.5
1654
045F:  BCF    05.0
1655
0460:  BSF    03.5
1656
0461:  BCF    05.1
1657
0462:  BCF    03.5
1658
0463:  BSF    05.1
1659
0464:  BSF    03.5
1660
0465:  BCF    05.6
1661
0466:  BCF    03.5
1662
0467:  BCF    05.6
1663
0468:  BSF    03.5
1664
0469:  BCF    05.7
1665
046A:  BCF    03.5
1666
046B:  BSF    05.7
1667
....................             Delay_ms(100); 
1668
046C:  MOVLW  64
1669
046D:  MOVWF  3A
1670
046E:  CALL   065
1671
....................             if (rovinka > 250 || speed > 170) delay_ms(50); 
1672
046F:  MOVF   2F,W
1673
0470:  SUBLW  FA
1674
0471:  BTFSS  03.0
1675
0472:  GOTO   477
1676
0473:  MOVF   2D,W
1677
0474:  SUBLW  AA
1678
0475:  BTFSC  03.0
1679
0476:  GOTO   47A
1680
0477:  MOVLW  32
1681
0478:  MOVWF  3A
1682
0479:  CALL   065
1683
....................          }; 
1684
....................          rovinka=0; 
1685
047A:  CLRF   2F
1686
.................... //         speed=R17; 
1687
....................       }; 
1688
....................    } 
1689
047B:  GOTO   2EF
1690
.................... } 
1691
047C:  SLEEP
1692
 
1693
Configuration Fuses:
1694
   Word  1: 3F38   NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
1695
   Word  2: 3FFC   NOFCMEN NOIESO