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