Subversion Repositories svnkaklik

Rev

Go to most recent revision | Details | Last modification | View Log

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