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               22-IV-06 16:00
2
 
3
               Filename: D:\KAKLIK\programy\PIC_C\roboti\istrobot\3Orbis\main.lst
4
 
5
               ROM used: 666 words (16%)
6
                         Largest free fragment is 2048
7
               RAM used: 32 (18%) at main() level
8
                         35 (20%) worst case
9
               Stack:    3 worst case (1 in main + 2 for interrupts)
10
 
11
*
12
0000:  MOVLW  00
13
0001:  MOVWF  0A
14
0002:  GOTO   089
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  3D,F
100
0045:  BTFSS  03.0
101
0046:  GOTO   052
102
0047:  MOVLW  3D
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  3A
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       6//10           // 3 stupne zataceni 
146
.................... #define  BEAR2       10//27 
147
.................... #define  BEAR3       40 
148
.................... #define  SPEEDMAX    160         // ANSMANN=140; GP=120; maximalni rozumna rychlost 
149
.................... #define  R17         255         // X nasobek rozumne rychlosti 
150
.................... #define  DOZNIVANI   10 
151
.................... #define  L           1     // cara vlevo 
152
.................... #define  S           2     // casa mezi sensory 
153
.................... #define  R           0     // cara vpravo 
154
....................  
155
.................... // servo 
156
.................... #define  SERVO PIN_A2 
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
.................... unsigned int8 line;           // na ktere strane byla detekovana cara 
179
.................... //unsigned int8 dira;         // pocita dobu po kterou je ztracena cara 
180
.................... unsigned int8 uhel;           // urcuje aktualni uhel zataceni 
181
.................... unsigned int8 speed;        // maximalni povolena rychlost 
182
.................... unsigned int8 rovinka;        // pocitadlo na zjisteni rovinky 
183
....................  
184
.................... short int preteceni;          // flag preteceni timeru1 
185
....................  
186
.................... signed int16  Lmotor;         // promene, ktere urcuji velikost vykonu na levem 
187
.................... signed int16  Rmotor;         // a pravem motoru 
188
....................  
189
.................... // makro pro PWM pro motory 
190
.................... #define GO(motor, direction, power) if(get_timer0()<=power) \ 
191
.................... {direction##motor;} else {stop##motor;} 
192
....................  
193
.................... //////////////////////////////////////////////////////////////////////////////// 
194
.................... /* 
195
.................... void diagnostika() 
196
.................... { 
197
....................    if(input(SW1))STOPR;STOPL;While(TRUE); 
198
.................... //   if(LSENSOR==true) output_high(LED2); else output_low(LED2); 
199
.................... //   if(RSENSOR==true) output_high(LED1); else output_low(LED1); 
200
.................... } 
201
.................... */ 
202
.................... //////////////////////////////////////////////////////////////////////////////// 
203
.................... #int_TIMER1 
204
.................... TIMER1_isr() 
205
.................... { 
206
....................    preteceni = true; 
207
*
208
003F:  BSF    2F.0
209
.................... } 
210
.................... //////////////////////////////////////////////////////////////////////////////// 
211
0040:  BCF    0C.0
212
0041:  BCF    0A.3
213
0042:  GOTO   028
214
.................... #int_TIMER2 
215
.................... TIMER2_isr()      // ovladani serva 
216
.................... { 
217
....................    unsigned int8 n; 
218
....................  
219
....................    output_high(SERVO); 
220
*
221
0053:  BSF    03.5
222
0054:  BCF    05.2
223
0055:  BCF    03.5
224
0056:  BSF    05.2
225
....................    delay_us(1000); 
226
0057:  CLRWDT
227
0058:  MOVLW  09
228
0059:  MOVWF  3C
229
005A:  MOVLW  6D
230
005B:  MOVWF  3D
231
005C:  CALL   043
232
005D:  DECFSZ 3C,F
233
005E:  GOTO   05A
234
....................    for(n=uhel; n>0; n--) Delay_us(2); 
235
005F:  MOVF   2C,W
236
0060:  MOVWF  3B
237
0061:  MOVF   3B,F
238
0062:  BTFSC  03.2
239
0063:  GOTO   06A
240
0064:  CLRWDT
241
0065:  NOP
242
0066:  NOP
243
0067:  NOP
244
0068:  DECF   3B,F
245
0069:  GOTO   061
246
....................    output_low(SERVO); 
247
006A:  BSF    03.5
248
006B:  BCF    05.2
249
006C:  BCF    03.5
250
006D:  BCF    05.2
251
.................... } 
252
....................  
253
.................... //////////////////////////////////////////////////////////////////////////////// 
254
006E:  BCF    0C.1
255
006F:  BCF    0A.3
256
0070:  GOTO   028
257
.................... short int IRcheck()                 // potvrdi detekci cihly 
258
.................... { 
259
....................    output_high(IRTX);               // vypne vysilac IR 
260
....................    delay_ms(100); 
261
....................  
262
....................    output_low(STROBE); 
263
....................    sensors = spi_read(0);         // cteni senzoru 
264
....................    sensors=~sensors; 
265
....................    output_high(STROBE); 
266
....................  
267
....................    if(true==bit_test(sensors,7))    // otestuje, jestli je stale detekovan IR signal 
268
....................    { 
269
....................       output_low(IRTX);             // zapne vysilac IR 
270
....................       delay_ms(100); 
271
....................  
272
....................       output_low(STROBE); 
273
....................       sensors = spi_read(0);         // cteni senzoru 
274
....................       sensors=~sensors; 
275
....................       output_high(STROBE); 
276
....................  
277
....................       if(false==bit_test(sensors,7))      // otestuje, jestli je detekovana cihla 
278
....................       { 
279
....................          output_high(IRTX);            // vypne vysilac IR 
280
....................          delay_ms(100); 
281
....................  
282
....................          output_low(STROBE); 
283
....................          sensors = spi_read(0);         // cteni senzoru 
284
....................          sensors=~sensors; 
285
....................          output_high(STROBE); 
286
....................  
287
....................          output_low(IRTX);             // zapne vysilac IR 
288
....................          if(bit_test(sensors,7)) return 1; // vrat 1, kdyz je stale cihla 
289
....................       } 
290
....................    }; 
291
....................    output_low(IRTX);             // zapne vysilac IR 
292
....................    return 0; // vrat 0, kdyz je detekovano ruseni 
293
.................... } 
294
.................... //////////////////////////////////////////////////////////////////////////////// 
295
.................... void objizdka() 
296
.................... { 
297
....................    int8 shure=0; 
298
....................    unsigned int16 n; 
299
....................  
300
....................    BR;BL; 
301
....................    Delay_ms(400); 
302
....................    STOPR;STOPL; 
303
....................  
304
....................    uhel=KOLMO1;      // nastav zataceci kolecko kolmo na osu robota 
305
....................    Delay_ms(100); 
306
....................    BL;FR; 
307
....................    Delay_ms(200);    // minimalni toceni, kdyby se zastavilo sikmo k cihle 
308
....................  
309
....................    While(bit_test(sensors,7)) // toc, dokud neni cihla z primeho senzoru 
310
....................    { 
311
....................        sensors = spi_read(0);         // cteni senzoru 
312
....................        sensors=~sensors; 
313
....................        Delay_ms(4);              // cekani na SLAVE nez pripravi data od cidel 
314
....................    } 
315
....................    STOPL; STOPR; 
316
....................  
317
....................    for (n=0;n<1500;n++)    // vystred se na hranu cihly 
318
....................    { 
319
....................       if(!input(CIHLA)) {BL; FR;} else {FL; BR;}; 
320
....................       delay_ms(1); 
321
....................    } 
322
....................    STOPR;STOPL; 
323
....................  
324
....................    uhel=STRED;          // dopredu 
325
....................    delay_ms(100); 
326
....................    FR; FL; 
327
....................    delay_ms(500); 
328
....................    BL;BR; 
329
....................    delay_ms(200); 
330
....................    STOPL;STOPR; 
331
....................  
332
....................    uhel=STRED+BEAR3;    // doprava 
333
....................    delay_ms(100); 
334
....................    FL; 
335
....................    delay_ms(200); 
336
....................    uhel=STRED+BEAR2;    // min doprava 
337
....................    FL;FR; 
338
....................    delay_ms(200); 
339
....................    uhel=STRED+BEAR1;    // jeste min doprava 
340
....................    FL;FR; 
341
....................    delay_ms(200); 
342
....................    uhel=STRED;          // rovne 
343
....................    FL;FR; 
344
....................    delay_ms(100); 
345
....................    While((sensors & 0b01111111)!=0) //dokud neni cara 
346
....................    { 
347
....................        sensors = spi_read(0);         // cteni senzoru 
348
....................        sensors=~sensors; 
349
....................        Delay_ms(4);              // cekani na SLAVE nez pripravi data od cidel 
350
....................    } 
351
....................    BL; BR; 
352
....................    delay_ms(400); 
353
....................  
354
....................    uhel=STRED-BEAR3;    // doleva 
355
.................... } 
356
....................  
357
.................... //////////////////////////////////////////////////////////////////////////////// 
358
.................... void main() 
359
.................... { 
360
*
361
0089:  CLRF   04
362
008A:  MOVLW  1F
363
008B:  ANDWF  03,F
364
008C:  MOVLW  70
365
008D:  BSF    03.5
366
008E:  MOVWF  0F
367
008F:  BCF    1F.4
368
0090:  BCF    1F.5
369
0091:  MOVF   1B,W
370
0092:  ANDLW  80
371
0093:  MOVWF  1B
372
0094:  MOVLW  07
373
0095:  MOVWF  1C
374
....................  
375
....................    unsigned int8 n; 
376
....................    unsigned int8 i,v; 
377
....................    unsigned int8 last_sensors; 
378
....................    unsigned int8 j=0; 
379
0096:  BCF    03.5
380
0097:  CLRF   38
381
....................  
382
....................    setup_adc_ports(NO_ANALOGS); 
383
0098:  BSF    03.5
384
0099:  BCF    1F.4
385
009A:  BCF    1F.5
386
009B:  MOVF   1B,W
387
009C:  ANDLW  80
388
009D:  MOVWF  1B
389
....................    setup_adc(ADC_CLOCK_INTERNAL); 
390
009E:  BCF    1F.6
391
009F:  BCF    03.5
392
00A0:  BSF    1F.6
393
00A1:  BSF    1F.7
394
00A2:  BSF    03.5
395
00A3:  BCF    1F.7
396
00A4:  BCF    03.5
397
00A5:  BSF    1F.0
398
....................    setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_16); 
399
00A6:  BCF    14.5
400
00A7:  BSF    03.5
401
00A8:  BCF    06.2
402
00A9:  BSF    06.1
403
00AA:  BCF    06.4
404
00AB:  MOVLW  31
405
00AC:  BCF    03.5
406
00AD:  MOVWF  14
407
00AE:  MOVLW  00
408
00AF:  BSF    03.5
409
00B0:  MOVWF  14
410
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 
411
00B1:  MOVF   01,W
412
00B2:  ANDLW  C7
413
00B3:  IORLW  08
414
00B4:  MOVWF  01
415
....................    setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); 
416
00B5:  MOVLW  B5
417
00B6:  BCF    03.5
418
00B7:  MOVWF  10
419
....................    setup_timer_2(T2_DIV_BY_16,140,16); 
420
00B8:  MOVLW  78
421
00B9:  MOVWF  78
422
00BA:  IORLW  06
423
00BB:  MOVWF  12
424
00BC:  MOVLW  8C
425
00BD:  BSF    03.5
426
00BE:  MOVWF  12
427
....................    setup_oscillator(OSC_8MHZ|OSC_INTRC); 
428
00BF:  MOVLW  72
429
00C0:  MOVWF  0F
430
....................  
431
....................    STOPR; STOPL;  // zastav motory 
432
00C1:  BCF    05.6
433
00C2:  BCF    03.5
434
00C3:  BCF    05.6
435
00C4:  BSF    03.5
436
00C5:  BCF    05.7
437
00C6:  BCF    03.5
438
00C7:  BCF    05.7
439
00C8:  BSF    03.5
440
00C9:  BCF    05.0
441
00CA:  BCF    03.5
442
00CB:  BCF    05.0
443
00CC:  BSF    03.5
444
00CD:  BCF    05.1
445
00CE:  BCF    03.5
446
00CF:  BCF    05.1
447
....................    Lmotor=0;Rmotor=0; 
448
00D0:  CLRF   31
449
00D1:  CLRF   30
450
00D2:  CLRF   33
451
00D3:  CLRF   32
452
....................  
453
....................    uhel = STRED;    // nastav zadni kolecko na stred 
454
00D4:  MOVLW  80
455
00D5:  MOVWF  2C
456
....................    rovinka = 0; 
457
00D6:  CLRF   2E
458
....................  
459
....................    enable_interrupts(INT_TIMER2); 
460
00D7:  BSF    03.5
461
00D8:  BSF    0C.1
462
....................    enable_interrupts(INT_TIMER1); 
463
00D9:  BSF    0C.0
464
....................    enable_interrupts(GLOBAL); 
465
00DA:  MOVLW  C0
466
00DB:  BCF    03.5
467
00DC:  IORWF  0B,F
468
....................  
469
....................    output_low(IRTX); // zapni IR vysilac 
470
00DD:  BSF    03.5
471
00DE:  BCF    06.2
472
00DF:  BCF    03.5
473
00E0:  BCF    06.2
474
....................  
475
....................    delay_ms(1000); 
476
00E1:  MOVLW  04
477
00E2:  MOVWF  39
478
00E3:  MOVLW  FA
479
00E4:  MOVWF  3A
480
00E5:  CALL   071
481
00E6:  DECFSZ 39,F
482
00E7:  GOTO   0E3
483
....................  
484
.................... //!!!! 
485
.................... speed=SPEEDMAX; 
486
00E8:  MOVLW  A0
487
00E9:  MOVWF  2D
488
....................  
489
....................    while(true) 
490
....................    { 
491
....................  
492
....................       GO(L,F,Lmotor);GO(R,F,Rmotor);   // zapni motory PWM podle promenych Lmotor a Rmotor 
493
00EA:  MOVF   01,W
494
00EB:  BTFSS  00.7
495
00EC:  GOTO   0F0
496
00ED:  BTFSS  31.7
497
00EE:  GOTO   0F8
498
00EF:  GOTO   0F2
499
00F0:  BTFSC  31.7
500
00F1:  GOTO   101
501
00F2:  MOVF   31,F
502
00F3:  BTFSS  03.2
503
00F4:  GOTO   0F8
504
00F5:  SUBWF  30,W
505
00F6:  BTFSS  03.0
506
00F7:  GOTO   101
507
00F8:  BSF    03.5
508
00F9:  BCF    05.1
509
00FA:  BCF    03.5
510
00FB:  BCF    05.1
511
00FC:  BSF    03.5
512
00FD:  BCF    05.0
513
00FE:  BCF    03.5
514
00FF:  BSF    05.0
515
0100:  GOTO   109
516
0101:  BSF    03.5
517
0102:  BCF    05.0
518
0103:  BCF    03.5
519
0104:  BCF    05.0
520
0105:  BSF    03.5
521
0106:  BCF    05.1
522
0107:  BCF    03.5
523
0108:  BCF    05.1
524
0109:  MOVF   01,W
525
010A:  BTFSS  00.7
526
010B:  GOTO   10F
527
010C:  BTFSS  33.7
528
010D:  GOTO   117
529
010E:  GOTO   111
530
010F:  BTFSC  33.7
531
0110:  GOTO   120
532
0111:  MOVF   33,F
533
0112:  BTFSS  03.2
534
0113:  GOTO   117
535
0114:  SUBWF  32,W
536
0115:  BTFSS  03.0
537
0116:  GOTO   120
538
0117:  BSF    03.5
539
0118:  BCF    05.7
540
0119:  BCF    03.5
541
011A:  BCF    05.7
542
011B:  BSF    03.5
543
011C:  BCF    05.6
544
011D:  BCF    03.5
545
011E:  BSF    05.6
546
011F:  GOTO   128
547
0120:  BSF    03.5
548
0121:  BCF    05.6
549
0122:  BCF    03.5
550
0123:  BCF    05.6
551
0124:  BSF    03.5
552
0125:  BCF    05.7
553
0126:  BCF    03.5
554
0127:  BCF    05.7
555
....................  
556
....................       delay_us(1500);                  // cekani na SLAVE, nez pripravi data od cidel 
557
0128:  CLRWDT
558
0129:  MOVLW  01
559
012A:  MOVWF  3A
560
012B:  CALL   071
561
012C:  MOVLW  02
562
012D:  MOVWF  39
563
012E:  CLRF   29
564
012F:  BTFSC  0B.7
565
0130:  BSF    29.7
566
0131:  BCF    0B.7
567
0132:  MOVLW  F7
568
0133:  MOVWF  3D
569
0134:  CALL   043
570
0135:  BTFSC  29.7
571
0136:  BSF    0B.7
572
0137:  DECFSZ 39,F
573
0138:  GOTO   12E
574
....................  
575
....................       last_sensors = sensors; 
576
0139:  MOVF   2A,W
577
013A:  MOVWF  37
578
....................       j++; 
579
013B:  INCF   38,F
580
....................  
581
....................       output_low(STROBE);              // vypni zobrazovani na posuvnem registru 
582
013C:  BSF    03.5
583
013D:  BCF    06.0
584
013E:  BCF    03.5
585
013F:  BCF    06.0
586
....................       sensors = spi_read(0);           // cteni senzoru 
587
0140:  MOVF   13,W
588
0141:  CLRF   13
589
0142:  BSF    03.5
590
0143:  BTFSC  14.0
591
0144:  GOTO   147
592
0145:  BCF    03.5
593
0146:  GOTO   142
594
0147:  BCF    03.5
595
0148:  MOVF   13,W
596
0149:  MOVWF  2A
597
....................       sensors=~sensors; 
598
014A:  COMF   2A,F
599
....................       output_high(STROBE);       // zobraz data na posuvnem registru 
600
014B:  BSF    03.5
601
014C:  BCF    06.0
602
014D:  BCF    03.5
603
014E:  BSF    06.0
604
....................  
605
....................  
606
....................  
607
....................  
608
....................       if(false == preteceni) 
609
014F:  MOVLW  00
610
0150:  BTFSC  2F.0
611
0151:  MOVLW  01
612
0152:  XORLW  00
613
0153:  BTFSS  03.2
614
0154:  GOTO   16B
615
....................       { 
616
....................          v = 255 - (get_timer1() >> 8); 
617
0155:  MOVF   0F,W
618
0156:  MOVWF  7A
619
0157:  MOVF   0E,W
620
0158:  MOVWF  77
621
0159:  MOVF   0F,W
622
015A:  SUBWF  7A,W
623
015B:  BTFSS  03.2
624
015C:  GOTO   155
625
015D:  MOVF   77,W
626
015E:  MOVWF  39
627
015F:  MOVF   7A,W
628
0160:  MOVWF  3A
629
0161:  MOVF   3A,W
630
0162:  CLRF   7A
631
0163:  SUBLW  FF
632
0164:  MOVWF  36
633
....................          v >>= 3; 
634
0165:  RRF    36,F
635
0166:  RRF    36,F
636
0167:  RRF    36,F
637
0168:  MOVLW  1F
638
0169:  ANDWF  36,F
639
....................       } 
640
....................       else 
641
016A:  GOTO   16D
642
....................       { 
643
....................          v=0; 
644
016B:  CLRF   36
645
....................          preteceni=false; 
646
016C:  BCF    2F.0
647
....................       } 
648
....................  
649
....................  
650
....................  
651
....................       i=0;                       // havarijni kod 
652
016D:  CLRF   35
653
....................       for (n=0; n<=6; n++) 
654
016E:  CLRF   34
655
016F:  MOVF   34,W
656
0170:  SUBLW  06
657
0171:  BTFSS  03.0
658
0172:  GOTO   181
659
....................       { 
660
....................          if(bit_test(sensors,n)) i++; 
661
0173:  MOVF   2A,W
662
0174:  MOVWF  77
663
0175:  MOVF   34,W
664
0176:  MOVWF  78
665
0177:  BTFSC  03.2
666
0178:  GOTO   17D
667
0179:  BCF    03.0
668
017A:  RRF    77,F
669
017B:  DECFSZ 78,F
670
017C:  GOTO   179
671
017D:  BTFSC  77.0
672
017E:  INCF   35,F
673
....................       } 
674
017F:  INCF   34,F
675
0180:  GOTO   16F
676
....................       if (i>3) While(true){STOPR; STOPL;}; // zastavi, kdyz je cerno pod vice nez tremi cidly 
677
0181:  MOVF   35,W
678
0182:  SUBLW  03
679
0183:  BTFSC  03.0
680
0184:  GOTO   196
681
0185:  BSF    03.5
682
0186:  BCF    05.6
683
0187:  BCF    03.5
684
0188:  BCF    05.6
685
0189:  BSF    03.5
686
018A:  BCF    05.7
687
018B:  BCF    03.5
688
018C:  BCF    05.7
689
018D:  BSF    03.5
690
018E:  BCF    05.0
691
018F:  BCF    03.5
692
0190:  BCF    05.0
693
0191:  BSF    03.5
694
0192:  BCF    05.1
695
0193:  BCF    03.5
696
0194:  BCF    05.1
697
0195:  GOTO   185
698
....................  
699
....................  
700
....................  
701
....................       if(bit_test(sensors,7))    // detekce cihly 
702
0196:  BTFSS  2A.7
703
0197:  GOTO   198
704
....................       { 
705
.................... //!!!         objizdka();       // objede cihlu 
706
....................       } 
707
....................  
708
....................  
709
....................  
710
....................       if(bit_test(sensors,3)) //...|...// 
711
0198:  BTFSS  2A.3
712
0199:  GOTO   1AF
713
....................       { 
714
....................          uhel=STRED; 
715
019A:  MOVLW  80
716
019B:  MOVWF  2C
717
....................          Lmotor=speed; 
718
019C:  CLRF   7A
719
019D:  MOVF   2D,W
720
019E:  MOVWF  30
721
019F:  MOVF   7A,W
722
01A0:  MOVWF  31
723
....................          Rmotor=speed; 
724
01A1:  CLRF   7A
725
01A2:  MOVF   2D,W
726
01A3:  MOVWF  32
727
01A4:  MOVF   7A,W
728
01A5:  MOVWF  33
729
....................          line=S; 
730
01A6:  MOVLW  02
731
01A7:  MOVWF  2B
732
....................          set_timer1(0); 
733
01A8:  CLRF   0F
734
01A9:  CLRF   0E
735
....................          if (rovinka < 255) rovinka++; 
736
01AA:  INCFSZ 2E,W
737
01AB:  GOTO   1AD
738
01AC:  GOTO   1AE
739
01AD:  INCF   2E,F
740
.................... //         if (speed > SPEEDMAX) speed--; 
741
....................          continue; 
742
01AE:  GOTO   0EA
743
....................       } 
744
....................  
745
....................       if(bit_test(sensors,0)) //|......//     // z duvodu zkraceni doby reakce se cidla nevyhodnocuji poporade ale od krajnich k prostrednimu 
746
01AF:  BTFSS  2A.0
747
01B0:  GOTO   1CD
748
....................       { 
749
....................          if(sensors != last_sensors) uhel=STRED - BEAR3 - v; 
750
01B1:  MOVF   37,W
751
01B2:  SUBWF  2A,W
752
01B3:  BTFSC  03.2
753
01B4:  GOTO   1B8
754
01B5:  MOVF   36,W
755
01B6:  SUBLW  58
756
01B7:  MOVWF  2C
757
....................          if(j>=DOZNIVANI) 
758
01B8:  MOVF   38,W
759
01B9:  SUBLW  09
760
01BA:  BTFSC  03.0
761
01BB:  GOTO   1C1
762
....................          { 
763
....................             j=0; 
764
01BC:  CLRF   38
765
....................             if(uhel<STRED - BEAR3) uhel++; 
766
01BD:  MOVF   2C,W
767
01BE:  SUBLW  57
768
01BF:  BTFSC  03.0
769
01C0:  INCF   2C,F
770
....................          } 
771
....................          Lmotor=0; 
772
01C1:  CLRF   31
773
01C2:  CLRF   30
774
....................          Rmotor=speed; 
775
01C3:  CLRF   7A
776
01C4:  MOVF   2D,W
777
01C5:  MOVWF  32
778
01C6:  MOVF   7A,W
779
01C7:  MOVWF  33
780
....................          line=L; 
781
01C8:  MOVLW  01
782
01C9:  MOVWF  2B
783
....................          set_timer1(0); 
784
01CA:  CLRF   0F
785
01CB:  CLRF   0E
786
.................... //         if (speed > SPEEDMAX) speed--; 
787
....................          continue; 
788
01CC:  GOTO   0EA
789
....................       } 
790
....................  
791
....................       if(bit_test(sensors,6)) //......|// 
792
01CD:  BTFSS  2A.6
793
01CE:  GOTO   1EA
794
....................       { 
795
....................          if(sensors != last_sensors) uhel=STRED + BEAR3 + v; 
796
01CF:  MOVF   37,W
797
01D0:  SUBWF  2A,W
798
01D1:  BTFSC  03.2
799
01D2:  GOTO   1D6
800
01D3:  MOVLW  A8
801
01D4:  ADDWF  36,W
802
01D5:  MOVWF  2C
803
....................          if(j>=DOZNIVANI) 
804
01D6:  MOVF   38,W
805
01D7:  SUBLW  09
806
01D8:  BTFSC  03.0
807
01D9:  GOTO   1DF
808
....................          { 
809
....................             j=0; 
810
01DA:  CLRF   38
811
....................             if(uhel>STRED + BEAR3) uhel--; 
812
01DB:  MOVF   2C,W
813
01DC:  SUBLW  A8
814
01DD:  BTFSS  03.0
815
01DE:  DECF   2C,F
816
....................          } 
817
....................          Rmotor=0; 
818
01DF:  CLRF   33
819
01E0:  CLRF   32
820
....................          Lmotor=speed; 
821
01E1:  CLRF   7A
822
01E2:  MOVF   2D,W
823
01E3:  MOVWF  30
824
01E4:  MOVF   7A,W
825
01E5:  MOVWF  31
826
....................          line=R; 
827
01E6:  CLRF   2B
828
....................          set_timer1(0); 
829
01E7:  CLRF   0F
830
01E8:  CLRF   0E
831
.................... //         if (speed > SPEEDMAX) speed--; 
832
....................          continue; 
833
01E9:  GOTO   0EA
834
....................       } 
835
....................  
836
....................       if(bit_test(sensors,1)) //.|.....// 
837
01EA:  BTFSS  2A.1
838
01EB:  GOTO   20C
839
....................       { 
840
....................          if(sensors != last_sensors) uhel=STRED - BEAR2 - v; 
841
01EC:  MOVF   37,W
842
01ED:  SUBWF  2A,W
843
01EE:  BTFSC  03.2
844
01EF:  GOTO   1F3
845
01F0:  MOVF   36,W
846
01F1:  SUBLW  76
847
01F2:  MOVWF  2C
848
....................          if(j>=DOZNIVANI) 
849
01F3:  MOVF   38,W
850
01F4:  SUBLW  09
851
01F5:  BTFSC  03.0
852
01F6:  GOTO   1FC
853
....................          { 
854
....................             j=0; 
855
01F7:  CLRF   38
856
....................             if(uhel<STRED - BEAR2) uhel++; 
857
01F8:  MOVF   2C,W
858
01F9:  SUBLW  75
859
01FA:  BTFSC  03.0
860
01FB:  INCF   2C,F
861
....................          } 
862
....................          Lmotor=speed-50; 
863
01FC:  MOVLW  32
864
01FD:  SUBWF  2D,W
865
01FE:  CLRF   7A
866
01FF:  MOVWF  30
867
0200:  MOVF   7A,W
868
0201:  MOVWF  31
869
....................          Rmotor=speed; 
870
0202:  CLRF   7A
871
0203:  MOVF   2D,W
872
0204:  MOVWF  32
873
0205:  MOVF   7A,W
874
0206:  MOVWF  33
875
....................          line=S; 
876
0207:  MOVLW  02
877
0208:  MOVWF  2B
878
....................          set_timer1(0); 
879
0209:  CLRF   0F
880
020A:  CLRF   0E
881
.................... //         if (speed > SPEEDMAX) speed--; 
882
....................          continue; 
883
020B:  GOTO   0EA
884
....................       } 
885
....................  
886
....................       if(bit_test(sensors,5)) //.....|.// 
887
020C:  BTFSS  2A.5
888
020D:  GOTO   22E
889
....................       { 
890
....................          if(sensors != last_sensors) uhel=STRED + BEAR2 + v; 
891
020E:  MOVF   37,W
892
020F:  SUBWF  2A,W
893
0210:  BTFSC  03.2
894
0211:  GOTO   215
895
0212:  MOVLW  8A
896
0213:  ADDWF  36,W
897
0214:  MOVWF  2C
898
....................          if(j>=DOZNIVANI) 
899
0215:  MOVF   38,W
900
0216:  SUBLW  09
901
0217:  BTFSC  03.0
902
0218:  GOTO   21E
903
....................          { 
904
....................             j=0; 
905
0219:  CLRF   38
906
....................             if(uhel>STRED + BEAR2) uhel--; 
907
021A:  MOVF   2C,W
908
021B:  SUBLW  8A
909
021C:  BTFSS  03.0
910
021D:  DECF   2C,F
911
....................          } 
912
....................          Rmotor=speed-50; 
913
021E:  MOVLW  32
914
021F:  SUBWF  2D,W
915
0220:  CLRF   7A
916
0221:  MOVWF  32
917
0222:  MOVF   7A,W
918
0223:  MOVWF  33
919
....................          Lmotor=speed; 
920
0224:  CLRF   7A
921
0225:  MOVF   2D,W
922
0226:  MOVWF  30
923
0227:  MOVF   7A,W
924
0228:  MOVWF  31
925
....................          line=S; 
926
0229:  MOVLW  02
927
022A:  MOVWF  2B
928
....................          set_timer1(0); 
929
022B:  CLRF   0F
930
022C:  CLRF   0E
931
.................... //         if (speed > SPEEDMAX) speed--; 
932
....................          continue; 
933
022D:  GOTO   0EA
934
....................       } 
935
....................  
936
....................       if (bit_test(sensors,2)) //..|....// 
937
022E:  BTFSS  2A.2
938
022F:  GOTO   253
939
....................       { 
940
....................          if(sensors != last_sensors) uhel=STRED - BEAR1 - v; 
941
0230:  MOVF   37,W
942
0231:  SUBWF  2A,W
943
0232:  BTFSC  03.2
944
0233:  GOTO   237
945
0234:  MOVF   36,W
946
0235:  SUBLW  7A
947
0236:  MOVWF  2C
948
....................          if(j>=DOZNIVANI) 
949
0237:  MOVF   38,W
950
0238:  SUBLW  09
951
0239:  BTFSC  03.0
952
023A:  GOTO   240
953
....................          { 
954
....................             if(uhel<STRED - BEAR1)uhel++; 
955
023B:  MOVF   2C,W
956
023C:  SUBLW  79
957
023D:  BTFSC  03.0
958
023E:  INCF   2C,F
959
....................             j=0; 
960
023F:  CLRF   38
961
....................          } 
962
....................          Lmotor=speed; 
963
0240:  CLRF   7A
964
0241:  MOVF   2D,W
965
0242:  MOVWF  30
966
0243:  MOVF   7A,W
967
0244:  MOVWF  31
968
....................          Rmotor=speed; 
969
0245:  CLRF   7A
970
0246:  MOVF   2D,W
971
0247:  MOVWF  32
972
0248:  MOVF   7A,W
973
0249:  MOVWF  33
974
....................          line=S; 
975
024A:  MOVLW  02
976
024B:  MOVWF  2B
977
....................          set_timer1(0); 
978
024C:  CLRF   0F
979
024D:  CLRF   0E
980
....................          if (rovinka<255) rovinka++; 
981
024E:  INCFSZ 2E,W
982
024F:  GOTO   251
983
0250:  GOTO   252
984
0251:  INCF   2E,F
985
.................... //         if (speed > SPEEDMAX) speed--; 
986
....................          continue; 
987
0252:  GOTO   0EA
988
....................       } 
989
....................  
990
....................       if (bit_test(sensors,4)) //....|..// 
991
0253:  BTFSS  2A.4
992
0254:  GOTO   278
993
....................       { 
994
....................          if(sensors != last_sensors) uhel=STRED + BEAR1 + v; 
995
0255:  MOVF   37,W
996
0256:  SUBWF  2A,W
997
0257:  BTFSC  03.2
998
0258:  GOTO   25C
999
0259:  MOVLW  86
1000
025A:  ADDWF  36,W
1001
025B:  MOVWF  2C
1002
....................          if(j>=DOZNIVANI) 
1003
025C:  MOVF   38,W
1004
025D:  SUBLW  09
1005
025E:  BTFSC  03.0
1006
025F:  GOTO   265
1007
....................          { 
1008
....................             j=0; 
1009
0260:  CLRF   38
1010
....................             if(uhel>STRED + BEAR1) uhel--; 
1011
0261:  MOVF   2C,W
1012
0262:  SUBLW  86
1013
0263:  BTFSS  03.0
1014
0264:  DECF   2C,F
1015
....................          } 
1016
....................          Rmotor=speed; 
1017
0265:  CLRF   7A
1018
0266:  MOVF   2D,W
1019
0267:  MOVWF  32
1020
0268:  MOVF   7A,W
1021
0269:  MOVWF  33
1022
....................          Lmotor=speed; 
1023
026A:  CLRF   7A
1024
026B:  MOVF   2D,W
1025
026C:  MOVWF  30
1026
026D:  MOVF   7A,W
1027
026E:  MOVWF  31
1028
....................          line=S; 
1029
026F:  MOVLW  02
1030
0270:  MOVWF  2B
1031
....................          set_timer1(0); 
1032
0271:  CLRF   0F
1033
0272:  CLRF   0E
1034
....................          if (rovinka<255) rovinka++; 
1035
0273:  INCFSZ 2E,W
1036
0274:  GOTO   276
1037
0275:  GOTO   277
1038
0276:  INCF   2E,F
1039
.................... //         if (speed > SPEEDMAX) speed--; 
1040
....................          continue; 
1041
0277:  GOTO   0EA
1042
....................       } 
1043
....................  
1044
....................       if ((L==line) || (R==line)) // Brzdeni pri vyjeti z trate 
1045
0278:  DECFSZ 2B,W
1046
0279:  GOTO   27B
1047
027A:  GOTO   27E
1048
027B:  MOVF   2B,F
1049
027C:  BTFSS  03.2
1050
027D:  GOTO   298
1051
....................       { 
1052
....................          if (rovinka>250) 
1053
027E:  MOVF   2E,W
1054
027F:  SUBLW  FA
1055
0280:  BTFSC  03.0
1056
0281:  GOTO   295
1057
....................          { 
1058
....................             BL; BR; 
1059
0282:  BSF    03.5
1060
0283:  BCF    05.0
1061
0284:  BCF    03.5
1062
0285:  BCF    05.0
1063
0286:  BSF    03.5
1064
0287:  BCF    05.1
1065
0288:  BCF    03.5
1066
0289:  BSF    05.1
1067
028A:  BSF    03.5
1068
028B:  BCF    05.6
1069
028C:  BCF    03.5
1070
028D:  BCF    05.6
1071
028E:  BSF    03.5
1072
028F:  BCF    05.7
1073
0290:  BCF    03.5
1074
0291:  BSF    05.7
1075
....................             Delay_ms(100); 
1076
0292:  MOVLW  64
1077
0293:  MOVWF  3A
1078
0294:  CALL   071
1079
....................          }; 
1080
....................          rovinka=0; 
1081
0295:  CLRF   2E
1082
....................          speed=SPEEDMAX; 
1083
0296:  MOVLW  A0
1084
0297:  MOVWF  2D
1085
....................       }; 
1086
....................    } 
1087
0298:  GOTO   0EA
1088
.................... } 
1089
0299:  SLEEP
1090
 
1091
Configuration Fuses:
1092
   Word  1: 3F38   NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
1093
   Word  2: 3FFC   NOFCMEN NOIESO