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