193 |
miho |
1 |
CCS PCW C Compiler, Version 3.110, 15448 |
|
|
2 |
|
|
|
3 |
Filename: c:\miho_dat\dart\dart.LST |
|
|
4 |
|
|
|
5 |
ROM used: 964 (24%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 24 (14%) at main() level |
|
|
8 |
41 (23%) worst case |
|
|
9 |
Stack: 6 worst case (3 in main + 3 for interrupts) |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 00 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 204 |
|
|
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.3 |
|
|
43 |
001F: GOTO 022 |
|
|
44 |
0020: BTFSC 0C.3 |
|
|
45 |
0021: GOTO 039 |
|
|
46 |
0022: BTFSS 0B.5 |
|
|
47 |
0023: GOTO 026 |
|
|
48 |
0024: BTFSC 0B.2 |
|
|
49 |
0025: GOTO 03B |
|
|
50 |
0026: MOVF 22,W |
|
|
51 |
0027: MOVWF 04 |
|
|
52 |
0028: MOVF 23,W |
|
|
53 |
0029: MOVWF 77 |
|
|
54 |
002A: MOVF 24,W |
|
|
55 |
002B: MOVWF 78 |
|
|
56 |
002C: MOVF 25,W |
|
|
57 |
002D: MOVWF 79 |
|
|
58 |
002E: MOVF 26,W |
|
|
59 |
002F: MOVWF 7A |
|
|
60 |
0030: MOVF 27,W |
|
|
61 |
0031: MOVWF 7B |
|
|
62 |
0032: MOVF 28,W |
|
|
63 |
0033: MOVWF 0A |
|
|
64 |
0034: SWAPF 21,W |
|
|
65 |
0035: MOVWF 03 |
|
|
66 |
0036: SWAPF 7F,F |
|
|
67 |
0037: SWAPF 7F,W |
|
|
68 |
0038: RETFIE |
|
|
69 |
0039: BCF 0A.3 |
|
|
70 |
003A: GOTO 096 |
|
|
71 |
003B: BCF 0A.3 |
|
|
72 |
003C: GOTO 0C4 |
|
|
73 |
.................... // DART01A verze programu 1.00 |
|
|
74 |
.................... // (c)miho 2005 |
|
|
75 |
.................... |
|
|
76 |
.................... #include "DART.h" |
|
|
77 |
.................... // DART01A verze programu 1.00 |
|
|
78 |
.................... // (c)miho 2005 |
|
|
79 |
.................... |
|
|
80 |
.................... #include <16F88.h> // standardni definice konstant |
|
|
81 |
.................... //////// Header file for the PIC16F88 |
|
|
82 |
.................... #device PIC16F88 |
|
|
83 |
.................... #list |
|
|
84 |
.................... #include <16F88_Reg.h> // standardni definice vsech FSR |
|
|
85 |
.................... #list |
|
|
86 |
.................... |
|
|
87 |
.................... |
|
|
88 |
.................... #device adc=8 // AD prevodnik jen na 8 bitu |
|
|
89 |
.................... #define xclock 4168000 // muj konkretni PIC je trochu rychlejsi |
|
|
90 |
.................... #use delay(clock=xclock,restart_wdt) |
|
|
91 |
* |
|
|
92 |
00EF: MOVLW 3C |
|
|
93 |
00F0: MOVWF 04 |
|
|
94 |
00F1: MOVF 00,W |
|
|
95 |
00F2: BTFSC 03.2 |
|
|
96 |
00F3: GOTO 105 |
|
|
97 |
00F4: MOVLW 01 |
|
|
98 |
00F5: MOVWF 78 |
|
|
99 |
00F6: MOVLW BF |
|
|
100 |
00F7: MOVWF 77 |
|
|
101 |
00F8: CLRWDT |
|
|
102 |
00F9: DECFSZ 77,F |
|
|
103 |
00FA: GOTO 0F8 |
|
|
104 |
00FB: DECFSZ 78,F |
|
|
105 |
00FC: GOTO 0F6 |
|
|
106 |
00FD: MOVLW 58 |
|
|
107 |
00FE: MOVWF 77 |
|
|
108 |
00FF: DECFSZ 77,F |
|
|
109 |
0100: GOTO 0FF |
|
|
110 |
0101: NOP |
|
|
111 |
0102: CLRWDT |
|
|
112 |
0103: DECFSZ 00,F |
|
|
113 |
0104: GOTO 0F4 |
|
|
114 |
0105: RETLW 00 |
|
|
115 |
.................... #fuses INTRC_IO, WDT, NOPUT, NOPROTECT, NOBROWNOUT, MCLR, NOLVP, NOCPD, NODEBUG, CCPB3 |
|
|
116 |
.................... |
|
|
117 |
.................... |
|
|
118 |
.................... |
|
|
119 |
.................... #define BEEP0 PIN_A6 // pipak, prvni vystup |
|
|
120 |
.................... #define BEEP1 PIN_A7 // pipak, druhy vystup |
|
|
121 |
.................... #define PWM PIN_B3 // PWM vystup pro menic |
|
|
122 |
.................... #define REFPOWER PIN_B1 // napajeni zdroje Vref |
|
|
123 |
.................... #define MOTOR PIN_B2 // zapinani motoru |
|
|
124 |
.................... #define SW0 PIN_B7 // konfiguracni prepinac 0 |
|
|
125 |
.................... #define SW1 PIN_B6 // konfiguracni prepinac 1 |
|
|
126 |
.................... |
|
|
127 |
.................... |
|
|
128 |
.................... void InitRS232() |
|
|
129 |
.................... // Inicializace HW RS232 |
|
|
130 |
.................... { |
|
|
131 |
.................... SPBRG=xclock/9600/16-1; // ryclost 9600Bd |
|
|
132 |
* |
|
|
133 |
00E3: MOVLW 1A |
|
|
134 |
00E4: BSF 03.5 |
|
|
135 |
00E5: MOVWF 19 |
|
|
136 |
.................... RCSTA=0b10000000; // enable USART |
|
|
137 |
00E6: MOVLW 80 |
|
|
138 |
00E7: BCF 03.5 |
|
|
139 |
00E8: MOVWF 18 |
|
|
140 |
.................... TXSTA=0b00100100; // BRGH=1, TX enable |
|
|
141 |
00E9: MOVLW 24 |
|
|
142 |
00EA: BSF 03.5 |
|
|
143 |
00EB: MOVWF 18 |
|
|
144 |
00EC: BCF 03.5 |
|
|
145 |
00ED: BCF 0A.3 |
|
|
146 |
00EE: GOTO 228 (RETURN) |
|
|
147 |
.................... } |
|
|
148 |
.................... |
|
|
149 |
.................... |
|
|
150 |
.................... void Putc(char c) |
|
|
151 |
.................... // Posilani znaku pres HW RS232 |
|
|
152 |
.................... { |
|
|
153 |
.................... while(TRMT==0); // cekej na prazdny TX buffer |
|
|
154 |
* |
|
|
155 |
0106: MOVLW 00 |
|
|
156 |
0107: BSF 03.5 |
|
|
157 |
0108: BTFSC 18.1 |
|
|
158 |
0109: MOVLW 01 |
|
|
159 |
010A: XORLW 00 |
|
|
160 |
010B: BTFSS 03.2 |
|
|
161 |
010C: GOTO 110 |
|
|
162 |
010D: BCF 03.5 |
|
|
163 |
010E: GOTO 106 |
|
|
164 |
010F: BSF 03.5 |
|
|
165 |
.................... TXREG=c; // predej data |
|
|
166 |
0110: BCF 03.5 |
|
|
167 |
0111: MOVF 40,W |
|
|
168 |
0112: MOVWF 19 |
|
|
169 |
0113: RETLW 00 |
|
|
170 |
.................... } |
|
|
171 |
.................... |
|
|
172 |
.................... |
|
|
173 |
.................... // Globalni promenna pro data posilana na SSP |
|
|
174 |
.................... // Nastavuje se funkci MotorPatternSet() |
|
|
175 |
.................... // Vyuziva se v prerusovaci rutine IntSSP() |
|
|
176 |
.................... unsigned int8 MotorPattern; // aktualni data pro SSP jednotku |
|
|
177 |
.................... |
|
|
178 |
.................... |
|
|
179 |
.................... void MotorPatternSet(unsigned int Gear) |
|
|
180 |
.................... // Na zaklade rychlosti nastavi MotorPattern pro SSP |
|
|
181 |
.................... // Rychlost 0 znamena stop, rychlost 8 je maximum |
|
|
182 |
.................... { |
|
|
183 |
.................... // Tabulka rychlost -> pattern pro SSP |
|
|
184 |
.................... unsigned int8 const ExpTab[8] = {0x02,0x06,0x0e,0x1e,0x3e,0x7e,0xfe,0xff}; |
|
|
185 |
* |
|
|
186 |
003D: BCF 0A.0 |
|
|
187 |
003E: BCF 0A.1 |
|
|
188 |
003F: BCF 0A.2 |
|
|
189 |
0040: ADDWF 02,F |
|
|
190 |
0041: RETLW 02 |
|
|
191 |
0042: RETLW 06 |
|
|
192 |
0043: RETLW 0E |
|
|
193 |
0044: RETLW 1E |
|
|
194 |
0045: RETLW 3E |
|
|
195 |
0046: RETLW 7E |
|
|
196 |
0047: RETLW FE |
|
|
197 |
0048: RETLW FF |
|
|
198 |
.................... |
|
|
199 |
.................... // Vyber patternu |
|
|
200 |
.................... if (Gear==0) // stav 0 znamena stop |
|
|
201 |
* |
|
|
202 |
009B: MOVF 43,F |
|
|
203 |
009C: BTFSS 03.2 |
|
|
204 |
009D: GOTO 0AA |
|
|
205 |
.................... { |
|
|
206 |
.................... output_low(MOTOR); // klidovy stav |
|
|
207 |
009E: BSF 03.5 |
|
|
208 |
009F: BCF 06.2 |
|
|
209 |
00A0: BCF 03.5 |
|
|
210 |
00A1: BCF 06.2 |
|
|
211 |
.................... SSPSTAT = 0; |
|
|
212 |
00A2: BSF 03.5 |
|
|
213 |
00A3: CLRF 14 |
|
|
214 |
.................... SSPCON1 = 0; // SPI stop |
|
|
215 |
00A4: BCF 03.5 |
|
|
216 |
00A5: CLRF 14 |
|
|
217 |
.................... disable_interrupts(INT_SSP); // neni preruseni od SSP |
|
|
218 |
00A6: BSF 03.5 |
|
|
219 |
00A7: BCF 0C.3 |
|
|
220 |
.................... } |
|
|
221 |
.................... else // rizeny vykon |
|
|
222 |
00A8: GOTO 0C2 |
|
|
223 |
00A9: BCF 03.5 |
|
|
224 |
.................... { |
|
|
225 |
.................... if (Gear>7) // stav 8 a vice znamena plny vykon |
|
|
226 |
00AA: MOVF 43,W |
|
|
227 |
00AB: SUBLW 07 |
|
|
228 |
00AC: BTFSC 03.0 |
|
|
229 |
00AD: GOTO 0B0 |
|
|
230 |
.................... { |
|
|
231 |
.................... Gear=8; // plny plyn |
|
|
232 |
00AE: MOVLW 08 |
|
|
233 |
00AF: MOVWF 43 |
|
|
234 |
.................... } |
|
|
235 |
.................... |
|
|
236 |
.................... MotorPattern=ExpTab[--Gear]; // prevod z hodnoty plynu na data pro SSP |
|
|
237 |
00B0: DECF 43,F |
|
|
238 |
00B1: MOVF 43,W |
|
|
239 |
00B2: CALL 03D |
|
|
240 |
00B3: MOVWF 78 |
|
|
241 |
00B4: MOVWF 29 |
|
|
242 |
.................... output_low(MOTOR); // klidovy stav |
|
|
243 |
00B5: BSF 03.5 |
|
|
244 |
00B6: BCF 06.2 |
|
|
245 |
00B7: BCF 03.5 |
|
|
246 |
00B8: BCF 06.2 |
|
|
247 |
.................... SSPSTAT = 0; |
|
|
248 |
00B9: BSF 03.5 |
|
|
249 |
00BA: CLRF 14 |
|
|
250 |
.................... SSPCON1 = 0x22; // SPI OSC/64 |
|
|
251 |
00BB: MOVLW 22 |
|
|
252 |
00BC: BCF 03.5 |
|
|
253 |
00BD: MOVWF 14 |
|
|
254 |
.................... |
|
|
255 |
.................... SSPBUF=MotorPattern; // prvni data pro vyslani |
|
|
256 |
00BE: MOVF 29,W |
|
|
257 |
00BF: MOVWF 13 |
|
|
258 |
.................... enable_interrupts(INT_SSP); // az budou vyslana prijde interrupt od SSP |
|
|
259 |
00C0: BSF 03.5 |
|
|
260 |
00C1: BSF 0C.3 |
|
|
261 |
.................... } |
|
|
262 |
00C2: BCF 03.5 |
|
|
263 |
00C3: RETLW 00 |
|
|
264 |
.................... } |
|
|
265 |
.................... |
|
|
266 |
.................... |
|
|
267 |
.................... // Obsluha preruseni od SSP jednotky, posila data z promenne MotorRun do SSP. |
|
|
268 |
.................... #INT_SSP |
|
|
269 |
.................... void IntSSP() |
|
|
270 |
.................... { |
|
|
271 |
.................... SSPBUF=MotorPattern; // znova hdnota PWM patternu na SSP |
|
|
272 |
* |
|
|
273 |
0096: MOVF 29,W |
|
|
274 |
0097: MOVWF 13 |
|
|
275 |
0098: BCF 0C.3 |
|
|
276 |
0099: BCF 0A.3 |
|
|
277 |
009A: GOTO 026 |
|
|
278 |
.................... } |
|
|
279 |
.................... |
|
|
280 |
.................... |
|
|
281 |
.................... void MotorSet(unsigned int Gear) |
|
|
282 |
.................... // Nastavi vykon motoru dle hodnoty Gear a zahaji posilani PWM dat pres SSP pod prerusenim |
|
|
283 |
.................... // od SSP jednotky |
|
|
284 |
.................... // 0 stop |
|
|
285 |
.................... // 1-7 pocet 1/8 vykonu |
|
|
286 |
.................... // >7 plny vykon |
|
|
287 |
.................... { |
|
|
288 |
* |
|
|
289 |
01CF: MOVF 0B,W |
|
|
290 |
01D0: ANDWF 0B,W |
|
|
291 |
01D1: BCF 0B.7 |
|
|
292 |
01D2: MOVWF 20 |
|
|
293 |
.................... // Nastav PWM pattern |
|
|
294 |
.................... MotorPatternSet(Gear); // nastav PWM pattern pro SSP |
|
|
295 |
01D3: MOVF 3C,W |
|
|
296 |
01D4: MOVWF 43 |
|
|
297 |
01D5: CALL 09B |
|
|
298 |
01D6: BTFSC 20.7 |
|
|
299 |
01D7: BSF 0B.7 |
|
|
300 |
.................... |
|
|
301 |
.................... // Povol preruseni |
|
|
302 |
.................... enable_interrupts(GLOBAL); // povol preruseni |
|
|
303 |
01D8: MOVLW C0 |
|
|
304 |
01D9: IORWF 0B,F |
|
|
305 |
01DA: RETLW 00 |
|
|
306 |
.................... } |
|
|
307 |
.................... |
|
|
308 |
.................... |
|
|
309 |
.................... void InitT0() |
|
|
310 |
.................... // Inicializace casovace T0 (cca 1000x za sekundu) |
|
|
311 |
.................... { |
|
|
312 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4); // T0 z internich hodin 1/4 |
|
|
313 |
* |
|
|
314 |
016D: BSF 03.5 |
|
|
315 |
016E: MOVF 01,W |
|
|
316 |
016F: ANDLW C0 |
|
|
317 |
0170: IORLW 01 |
|
|
318 |
0171: MOVWF 01 |
|
|
319 |
.................... enable_interrupts(INT_RTCC); // generuj preruseni od T0 |
|
|
320 |
0172: BCF 03.5 |
|
|
321 |
0173: BSF 0B.5 |
|
|
322 |
.................... enable_interrupts(GLOBAL); // povol preruseni |
|
|
323 |
0174: MOVLW C0 |
|
|
324 |
0175: IORWF 0B,F |
|
|
325 |
0176: BCF 0A.3 |
|
|
326 |
0177: GOTO 277 (RETURN) |
|
|
327 |
.................... } |
|
|
328 |
.................... |
|
|
329 |
.................... |
|
|
330 |
.................... // Globalni promenna pro mereni casu |
|
|
331 |
.................... // Nastavuje se procedurou TimeSet() |
|
|
332 |
.................... // Testuje se funkci TimeIf() |
|
|
333 |
.................... // Modifikuje se pri preruseni od casovace IntTo() |
|
|
334 |
.................... unsigned int16 TimeTime; |
|
|
335 |
.................... |
|
|
336 |
.................... |
|
|
337 |
.................... void TimerSet(unsigned int16 Time) |
|
|
338 |
.................... // Nastavi casovac na zadany pocet ms |
|
|
339 |
.................... // Test uplynuti casu se dela pomoci TimerIf() |
|
|
340 |
.................... { |
|
|
341 |
.................... // Nastav hodnotu |
|
|
342 |
.................... disable_interrupts(INT_RTCC); // nesmi prijit preruseni |
|
|
343 |
* |
|
|
344 |
01DB: BCF 0B.5 |
|
|
345 |
.................... TimeTime=Time; // pri nastavovani hodnoty |
|
|
346 |
01DC: MOVF 3D,W |
|
|
347 |
01DD: MOVWF 2B |
|
|
348 |
01DE: MOVF 3C,W |
|
|
349 |
01DF: MOVWF 2A |
|
|
350 |
.................... enable_interrupts(INT_RTCC); // promenne (o delce vice nez 8 bitu) |
|
|
351 |
01E0: BSF 0B.5 |
|
|
352 |
01E1: RETLW 00 |
|
|
353 |
.................... } |
|
|
354 |
.................... |
|
|
355 |
.................... |
|
|
356 |
.................... int1 TimerIf() |
|
|
357 |
.................... // Vraci TRUE pokud casovac jiz dobehl |
|
|
358 |
.................... { |
|
|
359 |
.................... int1 Flag; // pomocna promenna |
|
|
360 |
.................... |
|
|
361 |
.................... // Otestuj casovac |
|
|
362 |
.................... disable_interrupts(INT_RTCC); // nesmi prijit preruseni |
|
|
363 |
01E2: BCF 0B.5 |
|
|
364 |
.................... Flag=(TimeTime==0); // behem testu promenne |
|
|
365 |
01E3: MOVF 2A,F |
|
|
366 |
01E4: BTFSS 03.2 |
|
|
367 |
01E5: GOTO 1E9 |
|
|
368 |
01E6: MOVF 2B,F |
|
|
369 |
01E7: BTFSC 03.2 |
|
|
370 |
01E8: GOTO 1EB |
|
|
371 |
01E9: BCF 3C.0 |
|
|
372 |
01EA: GOTO 1EC |
|
|
373 |
01EB: BSF 3C.0 |
|
|
374 |
.................... enable_interrupts(INT_RTCC); // ted uz muze |
|
|
375 |
01EC: BSF 0B.5 |
|
|
376 |
.................... |
|
|
377 |
.................... // Navratova hodnota |
|
|
378 |
.................... return Flag; // TRUE znamena dobehl casovac |
|
|
379 |
01ED: MOVLW 00 |
|
|
380 |
01EE: BTFSC 3C.0 |
|
|
381 |
01EF: MOVLW 01 |
|
|
382 |
01F0: MOVWF 78 |
|
|
383 |
01F1: RETLW 00 |
|
|
384 |
.................... } |
|
|
385 |
.................... |
|
|
386 |
.................... |
|
|
387 |
.................... // Globalni promenne pro akceleraci |
|
|
388 |
.................... // Nastavuje se metodou MotorStart() |
|
|
389 |
.................... // Pouziva se v obsluze preruseni IntT0() |
|
|
390 |
.................... unsigned int8 MotorTime; // aktualni casovac pro rozjezd |
|
|
391 |
.................... unsigned int8 MotorDelay; // spozdeni mezi razenim |
|
|
392 |
.................... unsigned int8 MotorGear; // rychlostni stupen |
|
|
393 |
.................... |
|
|
394 |
.................... |
|
|
395 |
.................... void MotorStart(unsigned int8 Delay) |
|
|
396 |
.................... // Provede rizeny rozjezd motoru |
|
|
397 |
.................... { |
|
|
398 |
.................... disable_interrupts(INT_RTCC); |
|
|
399 |
01F2: BCF 0B.5 |
|
|
400 |
.................... MotorGear=1; |
|
|
401 |
01F3: MOVLW 01 |
|
|
402 |
01F4: MOVWF 2E |
|
|
403 |
.................... MotorDelay=Delay; |
|
|
404 |
01F5: MOVF 3C,W |
|
|
405 |
01F6: MOVWF 2D |
|
|
406 |
.................... MotorTime=MotorDelay; |
|
|
407 |
01F7: MOVF 2D,W |
|
|
408 |
01F8: MOVWF 2C |
|
|
409 |
.................... enable_interrupts(INT_RTCC); |
|
|
410 |
01F9: BSF 0B.5 |
|
|
411 |
01FA: MOVF 0B,W |
|
|
412 |
01FB: ANDWF 0B,W |
|
|
413 |
01FC: BCF 0B.7 |
|
|
414 |
01FD: MOVWF 20 |
|
|
415 |
.................... |
|
|
416 |
.................... MotorPatternSet(1); |
|
|
417 |
01FE: MOVLW 01 |
|
|
418 |
01FF: MOVWF 43 |
|
|
419 |
0200: CALL 09B |
|
|
420 |
0201: BTFSC 20.7 |
|
|
421 |
0202: BSF 0B.7 |
|
|
422 |
0203: RETLW 00 |
|
|
423 |
.................... } |
|
|
424 |
.................... |
|
|
425 |
.................... |
|
|
426 |
.................... #INT_TIMER0 |
|
|
427 |
.................... void IntT0() |
|
|
428 |
.................... // Preruseni od casovace cca 1000x za sekundu |
|
|
429 |
.................... { |
|
|
430 |
.................... // Odpocitavani casovace |
|
|
431 |
.................... if (TimeTime) TimeTime--; |
|
|
432 |
* |
|
|
433 |
00C4: MOVF 2A,W |
|
|
434 |
00C5: IORWF 2B,W |
|
|
435 |
00C6: BTFSC 03.2 |
|
|
436 |
00C7: GOTO 0CC |
|
|
437 |
00C8: MOVF 2A,W |
|
|
438 |
00C9: BTFSC 03.2 |
|
|
439 |
00CA: DECF 2B,F |
|
|
440 |
00CB: DECF 2A,F |
|
|
441 |
.................... |
|
|
442 |
.................... // Obsluha akcelerace |
|
|
443 |
.................... if (MotorTime) MotorTime--; // dekrementuj casovac rozjezdu |
|
|
444 |
00CC: MOVF 2C,F |
|
|
445 |
00CD: BTFSC 03.2 |
|
|
446 |
00CE: GOTO 0D0 |
|
|
447 |
00CF: DECF 2C,F |
|
|
448 |
.................... if ((MotorGear>0) && (MotorGear<8) && (!MotorTime)) // dalsi rychlostni stupen |
|
|
449 |
00D0: MOVF 2E,F |
|
|
450 |
00D1: BTFSC 03.2 |
|
|
451 |
00D2: GOTO 0E0 |
|
|
452 |
00D3: MOVF 2E,W |
|
|
453 |
00D4: SUBLW 07 |
|
|
454 |
00D5: BTFSS 03.0 |
|
|
455 |
00D6: GOTO 0E0 |
|
|
456 |
00D7: MOVF 2C,F |
|
|
457 |
00D8: BTFSS 03.2 |
|
|
458 |
00D9: GOTO 0E0 |
|
|
459 |
.................... { |
|
|
460 |
.................... MotorTime=MotorDelay; // znovu nastav casovac |
|
|
461 |
00DA: MOVF 2D,W |
|
|
462 |
00DB: MOVWF 2C |
|
|
463 |
.................... MotorGear++; // dalsi rychlost |
|
|
464 |
00DC: INCF 2E,F |
|
|
465 |
.................... MotorPatternSet(MotorGear); // nastav rychlost |
|
|
466 |
00DD: MOVF 2E,W |
|
|
467 |
00DE: MOVWF 43 |
|
|
468 |
00DF: CALL 09B |
|
|
469 |
.................... } |
|
|
470 |
00E0: BCF 0B.2 |
|
|
471 |
00E1: BCF 0A.3 |
|
|
472 |
00E2: GOTO 026 |
|
|
473 |
.................... } |
|
|
474 |
.................... |
|
|
475 |
.................... |
|
|
476 |
.................... // Cteni dat z AD prevodniku, zadava se cislo kanalu |
|
|
477 |
.................... int8 ReadAD(int8 Ch) |
|
|
478 |
.................... { |
|
|
479 |
.................... // Pokud merim Vref zapnu si jeho napajeni |
|
|
480 |
.................... if (Ch==4) output_high(REFPOWER); |
|
|
481 |
* |
|
|
482 |
0178: MOVF 3C,W |
|
|
483 |
0179: SUBLW 04 |
|
|
484 |
017A: BTFSS 03.2 |
|
|
485 |
017B: GOTO 180 |
|
|
486 |
017C: BSF 03.5 |
|
|
487 |
017D: BCF 06.1 |
|
|
488 |
017E: BCF 03.5 |
|
|
489 |
017F: BSF 06.1 |
|
|
490 |
.................... |
|
|
491 |
.................... // Inicializace a cislo kanalu |
|
|
492 |
.................... ADCON1=0x30; // Vref+-, bez deleni hodin, Left Justify |
|
|
493 |
0180: MOVLW 30 |
|
|
494 |
0181: BSF 03.5 |
|
|
495 |
0182: MOVWF 1F |
|
|
496 |
.................... ADCON0=0x41+(Ch<<3); // on, Tosc/8, cislo kanalu |
|
|
497 |
0183: BCF 03.5 |
|
|
498 |
0184: RLF 3C,W |
|
|
499 |
0185: MOVWF 77 |
|
|
500 |
0186: RLF 77,F |
|
|
501 |
0187: RLF 77,F |
|
|
502 |
0188: MOVLW F8 |
|
|
503 |
0189: ANDWF 77,F |
|
|
504 |
018A: MOVF 77,W |
|
|
505 |
018B: ADDLW 41 |
|
|
506 |
018C: MOVWF 1F |
|
|
507 |
.................... |
|
|
508 |
.................... // Mereni |
|
|
509 |
.................... delay_us(50); // doba na prepnuti kanalu |
|
|
510 |
018D: MOVLW 11 |
|
|
511 |
018E: MOVWF 77 |
|
|
512 |
018F: DECFSZ 77,F |
|
|
513 |
0190: GOTO 18F |
|
|
514 |
.................... ADCON0 |= 4; // start prevodu |
|
|
515 |
0191: BSF 1F.2 |
|
|
516 |
.................... delay_us(50); // doba na prevod |
|
|
517 |
0192: MOVLW 11 |
|
|
518 |
0193: MOVWF 77 |
|
|
519 |
0194: DECFSZ 77,F |
|
|
520 |
0195: GOTO 194 |
|
|
521 |
.................... |
|
|
522 |
.................... // Vypnu napajeni Vref (vzdycky) |
|
|
523 |
.................... output_low(REFPOWER); |
|
|
524 |
0196: BSF 03.5 |
|
|
525 |
0197: BCF 06.1 |
|
|
526 |
0198: BCF 03.5 |
|
|
527 |
0199: BCF 06.1 |
|
|
528 |
.................... |
|
|
529 |
.................... // Navrat hodnoty |
|
|
530 |
.................... return ADRESH; |
|
|
531 |
019A: MOVF 1E,W |
|
|
532 |
019B: MOVWF 78 |
|
|
533 |
019C: RETLW 00 |
|
|
534 |
.................... } |
|
|
535 |
.................... |
|
|
536 |
.................... |
|
|
537 |
.................... void main() |
|
|
538 |
.................... { |
|
|
539 |
.................... unsigned int8 Debug; |
|
|
540 |
.................... unsigned int8 i; |
|
|
541 |
* |
|
|
542 |
0204: CLRF 04 |
|
|
543 |
0205: MOVLW 1F |
|
|
544 |
0206: ANDWF 03,F |
|
|
545 |
0207: BSF 03.5 |
|
|
546 |
0208: CLRF 1F |
|
|
547 |
0209: CLRF 1D |
|
|
548 |
020A: MOVLW 07 |
|
|
549 |
020B: BCF 03.5 |
|
|
550 |
020C: MOVWF 1F |
|
|
551 |
.................... |
|
|
552 |
.................... // Hodiny |
|
|
553 |
.................... OSCCON = 0x62; // 4 MHz interni RC oscilator |
|
|
554 |
020D: MOVLW 62 |
|
|
555 |
020E: BSF 03.5 |
|
|
556 |
020F: MOVWF 0F |
|
|
557 |
.................... |
|
|
558 |
.................... // Digitalni vystupy |
|
|
559 |
.................... output_low(PWM); // PWM vystup |
|
|
560 |
0210: BCF 06.3 |
|
|
561 |
0211: BCF 03.5 |
|
|
562 |
0212: BCF 06.3 |
|
|
563 |
.................... output_low(MOTOR); // Proud do motoru |
|
|
564 |
0213: BSF 03.5 |
|
|
565 |
0214: BCF 06.2 |
|
|
566 |
0215: BCF 03.5 |
|
|
567 |
0216: BCF 06.2 |
|
|
568 |
.................... output_low(REFPOWER); // Napajeni Vref |
|
|
569 |
0217: BSF 03.5 |
|
|
570 |
0218: BCF 06.1 |
|
|
571 |
0219: BCF 03.5 |
|
|
572 |
021A: BCF 06.1 |
|
|
573 |
.................... port_b_pullups(TRUE); // Zbyvajici vyvody portu B |
|
|
574 |
021B: BSF 03.5 |
|
|
575 |
021C: BCF 01.7 |
|
|
576 |
.................... |
|
|
577 |
.................... // Watch Dog |
|
|
578 |
.................... PSA=0; // preddelic prirazen casovaci |
|
|
579 |
021D: BCF 01.3 |
|
|
580 |
.................... WDTCON=0x0E; // Watch Dog cca 130ms |
|
|
581 |
021E: MOVLW 0E |
|
|
582 |
021F: BCF 03.5 |
|
|
583 |
0220: BSF 03.6 |
|
|
584 |
0221: MOVWF 05 |
|
|
585 |
.................... |
|
|
586 |
.................... // Analogove vstupy |
|
|
587 |
.................... ANSEL = 0x1F; // AN0 az AN4 |
|
|
588 |
0222: MOVLW 1F |
|
|
589 |
0223: BSF 03.5 |
|
|
590 |
0224: BCF 03.6 |
|
|
591 |
0225: MOVWF 1B |
|
|
592 |
.................... |
|
|
593 |
.................... // nastaveni RS232 |
|
|
594 |
.................... InitRS232(); // inicializace HW RS232 (nutno pockat cca 10ms) |
|
|
595 |
0226: BCF 03.5 |
|
|
596 |
0227: GOTO 0E3 |
|
|
597 |
.................... |
|
|
598 |
.................... // Pipnuti (a cekani) |
|
|
599 |
.................... for (i=1;i<30;i++) // pocet 1/2 period |
|
|
600 |
0228: MOVLW 01 |
|
|
601 |
0229: MOVWF 30 |
|
|
602 |
022A: MOVF 30,W |
|
|
603 |
022B: SUBLW 1D |
|
|
604 |
022C: BTFSS 03.0 |
|
|
605 |
022D: GOTO 245 |
|
|
606 |
.................... { |
|
|
607 |
.................... int1 beep; // stavova promenna pro pipak |
|
|
608 |
.................... |
|
|
609 |
.................... output_bit(BEEP0,beep); |
|
|
610 |
022E: BTFSC 31.0 |
|
|
611 |
022F: GOTO 232 |
|
|
612 |
0230: BCF 05.6 |
|
|
613 |
0231: GOTO 233 |
|
|
614 |
0232: BSF 05.6 |
|
|
615 |
0233: BSF 03.5 |
|
|
616 |
0234: BCF 05.6 |
|
|
617 |
.................... beep=~beep; |
|
|
618 |
0235: MOVLW 01 |
|
|
619 |
0236: BCF 03.5 |
|
|
620 |
0237: XORWF 31,F |
|
|
621 |
.................... output_bit(BEEP1,beep); |
|
|
622 |
0238: BTFSC 31.0 |
|
|
623 |
0239: GOTO 23C |
|
|
624 |
023A: BCF 05.7 |
|
|
625 |
023B: GOTO 23D |
|
|
626 |
023C: BSF 05.7 |
|
|
627 |
023D: BSF 03.5 |
|
|
628 |
023E: BCF 05.7 |
|
|
629 |
.................... delay_us(1000); |
|
|
630 |
023F: MOVLW 01 |
|
|
631 |
0240: BCF 03.5 |
|
|
632 |
0241: MOVWF 3C |
|
|
633 |
0242: CALL 0EF |
|
|
634 |
.................... } |
|
|
635 |
0243: INCF 30,F |
|
|
636 |
0244: GOTO 22A |
|
|
637 |
.................... |
|
|
638 |
.................... // Rozhodnuti o rezimu cinnosti |
|
|
639 |
.................... Debug=0; |
|
|
640 |
0245: CLRF 2F |
|
|
641 |
.................... if (~input(SW0)) Debug|=1; // precti bit 0 |
|
|
642 |
0246: BSF 03.5 |
|
|
643 |
0247: BSF 06.7 |
|
|
644 |
0248: BCF 03.5 |
|
|
645 |
0249: BTFSC 06.7 |
|
|
646 |
024A: GOTO 24C |
|
|
647 |
024B: BSF 2F.0 |
|
|
648 |
.................... if (~input(SW1)) Debug|=2; // precti bit 1 |
|
|
649 |
024C: BSF 03.5 |
|
|
650 |
024D: BSF 06.6 |
|
|
651 |
024E: BCF 03.5 |
|
|
652 |
024F: BTFSC 06.6 |
|
|
653 |
0250: GOTO 252 |
|
|
654 |
0251: BSF 2F.1 |
|
|
655 |
.................... output_low(SW0); // nastav L aby se snizila spotreba |
|
|
656 |
0252: BSF 03.5 |
|
|
657 |
0253: BCF 06.7 |
|
|
658 |
0254: BCF 03.5 |
|
|
659 |
0255: BCF 06.7 |
|
|
660 |
.................... output_low(SW1); // na obou vstupech |
|
|
661 |
0256: BSF 03.5 |
|
|
662 |
0257: BCF 06.6 |
|
|
663 |
0258: BCF 03.5 |
|
|
664 |
0259: BCF 06.6 |
|
|
665 |
.................... |
|
|
666 |
.................... // Zobrazeni rezimu |
|
|
667 |
.................... printf(Putc,"\fMode:%d",Debug); |
|
|
668 |
* |
|
|
669 |
0049: BCF 0A.0 |
|
|
670 |
004A: BCF 0A.1 |
|
|
671 |
004B: BCF 0A.2 |
|
|
672 |
004C: ADDWF 02,F |
|
|
673 |
004D: RETLW 0C |
|
|
674 |
004E: RETLW 4D |
|
|
675 |
004F: RETLW 6F |
|
|
676 |
0050: RETLW 64 |
|
|
677 |
0051: RETLW 65 |
|
|
678 |
0052: RETLW 3A |
|
|
679 |
0053: RETLW 25 |
|
|
680 |
0054: RETLW 64 |
|
|
681 |
0055: RETLW 00 |
|
|
682 |
* |
|
|
683 |
0129: MOVF 3D,W |
|
|
684 |
012A: MOVWF 77 |
|
|
685 |
012B: BTFSC 3D.7 |
|
|
686 |
012C: GOTO 131 |
|
|
687 |
012D: BTFSS 3E.2 |
|
|
688 |
012E: GOTO 13B |
|
|
689 |
012F: MOVLW 20 |
|
|
690 |
0130: GOTO 136 |
|
|
691 |
0131: COMF 77,F |
|
|
692 |
0132: INCF 77,F |
|
|
693 |
0133: MOVF 77,W |
|
|
694 |
0134: MOVWF 3D |
|
|
695 |
0135: MOVLW 2D |
|
|
696 |
0136: MOVWF 78 |
|
|
697 |
0137: MOVWF 40 |
|
|
698 |
0138: CALL 106 |
|
|
699 |
0139: BTFSS 3E.2 |
|
|
700 |
013A: BSF 3E.3 |
|
|
701 |
013B: MOVF 3D,W |
|
|
702 |
013C: MOVWF 40 |
|
|
703 |
013D: MOVLW 64 |
|
|
704 |
013E: MOVWF 41 |
|
|
705 |
013F: CALL 114 |
|
|
706 |
0140: MOVF 77,W |
|
|
707 |
0141: MOVWF 3D |
|
|
708 |
0142: MOVF 78,W |
|
|
709 |
0143: MOVLW 30 |
|
|
710 |
0144: BTFSS 03.2 |
|
|
711 |
0145: GOTO 14D |
|
|
712 |
0146: BTFSC 3E.0 |
|
|
713 |
0147: BSF 3E.3 |
|
|
714 |
0148: BTFSC 3E.3 |
|
|
715 |
0149: GOTO 153 |
|
|
716 |
014A: BTFSC 3E.4 |
|
|
717 |
014B: MOVLW 20 |
|
|
718 |
014C: GOTO 14F |
|
|
719 |
014D: BCF 3E.3 |
|
|
720 |
014E: BCF 3E.4 |
|
|
721 |
014F: ADDWF 78,F |
|
|
722 |
0150: MOVF 78,W |
|
|
723 |
0151: MOVWF 40 |
|
|
724 |
0152: CALL 106 |
|
|
725 |
0153: MOVF 3D,W |
|
|
726 |
0154: MOVWF 40 |
|
|
727 |
0155: MOVLW 0A |
|
|
728 |
0156: MOVWF 41 |
|
|
729 |
0157: CALL 114 |
|
|
730 |
0158: MOVF 77,W |
|
|
731 |
0159: MOVWF 3D |
|
|
732 |
015A: MOVF 78,W |
|
|
733 |
015B: MOVLW 30 |
|
|
734 |
015C: BTFSS 03.2 |
|
|
735 |
015D: GOTO 162 |
|
|
736 |
015E: BTFSC 3E.3 |
|
|
737 |
015F: GOTO 166 |
|
|
738 |
0160: BTFSC 3E.4 |
|
|
739 |
0161: MOVLW 20 |
|
|
740 |
0162: ADDWF 78,F |
|
|
741 |
0163: MOVF 78,W |
|
|
742 |
0164: MOVWF 40 |
|
|
743 |
0165: CALL 106 |
|
|
744 |
0166: MOVLW 30 |
|
|
745 |
0167: ADDWF 3D,F |
|
|
746 |
0168: MOVF 3D,W |
|
|
747 |
0169: MOVWF 40 |
|
|
748 |
016A: CALL 106 |
|
|
749 |
016B: BCF 0A.3 |
|
|
750 |
016C: GOTO 269 (RETURN) |
|
|
751 |
* |
|
|
752 |
025A: CLRF 3C |
|
|
753 |
025B: MOVF 3C,W |
|
|
754 |
025C: CALL 049 |
|
|
755 |
025D: INCF 3C,F |
|
|
756 |
025E: MOVWF 40 |
|
|
757 |
025F: CALL 106 |
|
|
758 |
0260: MOVLW 06 |
|
|
759 |
0261: SUBWF 3C,W |
|
|
760 |
0262: BTFSS 03.2 |
|
|
761 |
0263: GOTO 25B |
|
|
762 |
0264: MOVF 2F,W |
|
|
763 |
0265: MOVWF 3D |
|
|
764 |
0266: MOVLW 18 |
|
|
765 |
0267: MOVWF 3E |
|
|
766 |
0268: GOTO 129 |
|
|
767 |
.................... |
|
|
768 |
.................... // Inicializace PWM |
|
|
769 |
.................... PR2 = 0x1F; // perioda PWM casovace |
|
|
770 |
0269: MOVLW 1F |
|
|
771 |
026A: BSF 03.5 |
|
|
772 |
026B: MOVWF 12 |
|
|
773 |
.................... T2CON = 0x04; // povoleni casovace T2 bez preddelicu a postdelicu |
|
|
774 |
026C: MOVLW 04 |
|
|
775 |
026D: BCF 03.5 |
|
|
776 |
026E: MOVWF 12 |
|
|
777 |
.................... CCP1CON = 0x0C; // PWM mode, lsb bity nulove |
|
|
778 |
026F: MOVLW 0C |
|
|
779 |
0270: MOVWF 17 |
|
|
780 |
.................... CCPR1L = 0; // na zacatku nulova data |
|
|
781 |
0271: CLRF 15 |
|
|
782 |
.................... output_low(PWM); // PWM vystup |
|
|
783 |
0272: BSF 03.5 |
|
|
784 |
0273: BCF 06.3 |
|
|
785 |
0274: BCF 03.5 |
|
|
786 |
0275: BCF 06.3 |
|
|
787 |
.................... |
|
|
788 |
.................... // Inicializace casovace |
|
|
789 |
.................... InitT0(); // nastav casovac na cca 1ms |
|
|
790 |
0276: GOTO 16D |
|
|
791 |
.................... |
|
|
792 |
.................... // Test menice PWM a rozjezdoveho PWM |
|
|
793 |
.................... if (Debug==1) |
|
|
794 |
0277: DECFSZ 2F,W |
|
|
795 |
0278: GOTO 2B0 |
|
|
796 |
.................... { |
|
|
797 |
.................... unsigned int8 Data1; // poteniometr P1 = PWM |
|
|
798 |
.................... unsigned int8 Data2; // poteniometr P2 = Rozjezd |
|
|
799 |
.................... |
|
|
800 |
.................... while (1) |
|
|
801 |
.................... { |
|
|
802 |
.................... // watch dog |
|
|
803 |
.................... restart_wdt(); |
|
|
804 |
0279: CLRWDT |
|
|
805 |
.................... |
|
|
806 |
.................... // mereni vstupu |
|
|
807 |
.................... Data1=ReadAD(0); // nacti parametr pro PWM |
|
|
808 |
027A: CLRF 3C |
|
|
809 |
027B: CALL 178 |
|
|
810 |
027C: MOVF 78,W |
|
|
811 |
027D: MOVWF 32 |
|
|
812 |
.................... Data1>>=2; // redukuj rozsah na 0 az 63 |
|
|
813 |
027E: RRF 32,F |
|
|
814 |
027F: RRF 32,F |
|
|
815 |
0280: MOVLW 3F |
|
|
816 |
0281: ANDWF 32,F |
|
|
817 |
.................... Data2=ReadAD(1); // nacti parametr pro rozjezd |
|
|
818 |
0282: MOVLW 01 |
|
|
819 |
0283: MOVWF 3C |
|
|
820 |
0284: CALL 178 |
|
|
821 |
0285: MOVF 78,W |
|
|
822 |
0286: MOVWF 33 |
|
|
823 |
.................... Data2>>=4; // redukuj rozsah na 0 az 15 |
|
|
824 |
0287: SWAPF 33,F |
|
|
825 |
0288: MOVLW 0F |
|
|
826 |
0289: ANDWF 33,F |
|
|
827 |
.................... |
|
|
828 |
.................... // zobrazeni |
|
|
829 |
.................... printf(Putc,"\nPWM:%03u RUN:%03u",Data1,Data2); |
|
|
830 |
* |
|
|
831 |
0056: BCF 0A.0 |
|
|
832 |
0057: BCF 0A.1 |
|
|
833 |
0058: BCF 0A.2 |
|
|
834 |
0059: ADDWF 02,F |
|
|
835 |
005A: RETLW 0A |
|
|
836 |
005B: RETLW 50 |
|
|
837 |
005C: RETLW 57 |
|
|
838 |
005D: RETLW 4D |
|
|
839 |
005E: RETLW 3A |
|
|
840 |
005F: RETLW 25 |
|
|
841 |
0060: RETLW 30 |
|
|
842 |
0061: RETLW 33 |
|
|
843 |
0062: RETLW 75 |
|
|
844 |
0063: RETLW 20 |
|
|
845 |
0064: RETLW 52 |
|
|
846 |
0065: RETLW 55 |
|
|
847 |
0066: RETLW 4E |
|
|
848 |
0067: RETLW 3A |
|
|
849 |
0068: RETLW 25 |
|
|
850 |
0069: RETLW 30 |
|
|
851 |
006A: RETLW 33 |
|
|
852 |
006B: RETLW 75 |
|
|
853 |
006C: RETLW 00 |
|
|
854 |
* |
|
|
855 |
019D: MOVF 78,W |
|
|
856 |
019E: MOVF 3E,W |
|
|
857 |
019F: MOVWF 40 |
|
|
858 |
01A0: MOVLW 64 |
|
|
859 |
01A1: MOVWF 41 |
|
|
860 |
01A2: CALL 114 |
|
|
861 |
01A3: MOVF 77,W |
|
|
862 |
01A4: MOVWF 3E |
|
|
863 |
01A5: MOVF 78,W |
|
|
864 |
01A6: MOVLW 30 |
|
|
865 |
01A7: BTFSS 03.2 |
|
|
866 |
01A8: GOTO 1B0 |
|
|
867 |
01A9: BTFSC 3F.0 |
|
|
868 |
01AA: BSF 3F.3 |
|
|
869 |
01AB: BTFSC 3F.3 |
|
|
870 |
01AC: GOTO 1B6 |
|
|
871 |
01AD: BTFSC 3F.4 |
|
|
872 |
01AE: MOVLW 20 |
|
|
873 |
01AF: GOTO 1B2 |
|
|
874 |
01B0: BCF 3F.3 |
|
|
875 |
01B1: BCF 3F.4 |
|
|
876 |
01B2: ADDWF 78,F |
|
|
877 |
01B3: MOVF 78,W |
|
|
878 |
01B4: MOVWF 40 |
|
|
879 |
01B5: CALL 106 |
|
|
880 |
01B6: MOVF 3E,W |
|
|
881 |
01B7: MOVWF 40 |
|
|
882 |
01B8: MOVLW 0A |
|
|
883 |
01B9: MOVWF 41 |
|
|
884 |
01BA: CALL 114 |
|
|
885 |
01BB: MOVF 77,W |
|
|
886 |
01BC: MOVWF 3E |
|
|
887 |
01BD: MOVF 78,W |
|
|
888 |
01BE: MOVLW 30 |
|
|
889 |
01BF: BTFSS 03.2 |
|
|
890 |
01C0: GOTO 1C5 |
|
|
891 |
01C1: BTFSC 3F.3 |
|
|
892 |
01C2: GOTO 1C9 |
|
|
893 |
01C3: BTFSC 3F.4 |
|
|
894 |
01C4: MOVLW 20 |
|
|
895 |
01C5: ADDWF 78,F |
|
|
896 |
01C6: MOVF 78,W |
|
|
897 |
01C7: MOVWF 40 |
|
|
898 |
01C8: CALL 106 |
|
|
899 |
01C9: MOVLW 30 |
|
|
900 |
01CA: ADDWF 3E,F |
|
|
901 |
01CB: MOVF 3E,W |
|
|
902 |
01CC: MOVWF 40 |
|
|
903 |
01CD: CALL 106 |
|
|
904 |
01CE: RETLW 00 |
|
|
905 |
* |
|
|
906 |
028A: CLRF 3C |
|
|
907 |
028B: MOVF 3C,W |
|
|
908 |
028C: CALL 056 |
|
|
909 |
028D: INCF 3C,F |
|
|
910 |
028E: MOVWF 40 |
|
|
911 |
028F: CALL 106 |
|
|
912 |
0290: MOVLW 05 |
|
|
913 |
0291: SUBWF 3C,W |
|
|
914 |
0292: BTFSS 03.2 |
|
|
915 |
0293: GOTO 28B |
|
|
916 |
0294: MOVF 32,W |
|
|
917 |
0295: MOVWF 3E |
|
|
918 |
0296: CLRF 3F |
|
|
919 |
0297: CALL 19D |
|
|
920 |
0298: MOVLW 09 |
|
|
921 |
0299: MOVWF 3D |
|
|
922 |
029A: MOVF 3D,W |
|
|
923 |
029B: CALL 056 |
|
|
924 |
029C: INCF 3D,F |
|
|
925 |
029D: MOVWF 40 |
|
|
926 |
029E: CALL 106 |
|
|
927 |
029F: MOVLW 0E |
|
|
928 |
02A0: SUBWF 3D,W |
|
|
929 |
02A1: BTFSS 03.2 |
|
|
930 |
02A2: GOTO 29A |
|
|
931 |
02A3: MOVF 33,W |
|
|
932 |
02A4: MOVWF 3E |
|
|
933 |
02A5: CLRF 3F |
|
|
934 |
02A6: CALL 19D |
|
|
935 |
.................... delay_ms(20); |
|
|
936 |
02A7: MOVLW 14 |
|
|
937 |
02A8: MOVWF 3C |
|
|
938 |
02A9: CALL 0EF |
|
|
939 |
.................... |
|
|
940 |
.................... // nastaveni parametru PWM |
|
|
941 |
.................... CCPR1L = Data1; |
|
|
942 |
02AA: MOVF 32,W |
|
|
943 |
02AB: MOVWF 15 |
|
|
944 |
.................... |
|
|
945 |
.................... // nastaveni parametru RUN |
|
|
946 |
.................... MotorSet(Data2); |
|
|
947 |
02AC: MOVF 33,W |
|
|
948 |
02AD: MOVWF 3C |
|
|
949 |
02AE: CALL 1CF |
|
|
950 |
.................... } |
|
|
951 |
02AF: GOTO 279 |
|
|
952 |
.................... } |
|
|
953 |
.................... |
|
|
954 |
.................... // Testovani rozjezdu |
|
|
955 |
.................... // Zadava se cas mezi stupni razeni pro rozjezd v ms |
|
|
956 |
.................... if (Debug==2) |
|
|
957 |
02B0: MOVF 2F,W |
|
|
958 |
02B1: SUBLW 02 |
|
|
959 |
02B2: BTFSS 03.2 |
|
|
960 |
02B3: GOTO 300 |
|
|
961 |
.................... { |
|
|
962 |
.................... int8 Data; |
|
|
963 |
.................... int8 Start; |
|
|
964 |
.................... |
|
|
965 |
.................... Start=0; // uvodni stav |
|
|
966 |
02B4: CLRF 35 |
|
|
967 |
.................... while(1) |
|
|
968 |
.................... { |
|
|
969 |
.................... // Nacti a zobraz parametr |
|
|
970 |
.................... Data=ReadAD(1); // potenciometr P2 = rozjezd |
|
|
971 |
02B5: MOVLW 01 |
|
|
972 |
02B6: MOVWF 3C |
|
|
973 |
02B7: CALL 178 |
|
|
974 |
02B8: MOVF 78,W |
|
|
975 |
02B9: MOVWF 34 |
|
|
976 |
.................... printf(Putc,"\nRUN: %3ums ",Data); // zobraz |
|
|
977 |
* |
|
|
978 |
006D: BCF 0A.0 |
|
|
979 |
006E: BCF 0A.1 |
|
|
980 |
006F: BCF 0A.2 |
|
|
981 |
0070: ADDWF 02,F |
|
|
982 |
0071: RETLW 0A |
|
|
983 |
0072: RETLW 52 |
|
|
984 |
0073: RETLW 55 |
|
|
985 |
0074: RETLW 4E |
|
|
986 |
0075: RETLW 3A |
|
|
987 |
0076: RETLW 20 |
|
|
988 |
0077: RETLW 25 |
|
|
989 |
0078: RETLW 33 |
|
|
990 |
0079: RETLW 75 |
|
|
991 |
007A: RETLW 6D |
|
|
992 |
007B: RETLW 73 |
|
|
993 |
007C: RETLW 20 |
|
|
994 |
007D: RETLW 00 |
|
|
995 |
* |
|
|
996 |
02BA: CLRF 3C |
|
|
997 |
02BB: MOVF 3C,W |
|
|
998 |
02BC: CALL 06D |
|
|
999 |
02BD: INCF 3C,F |
|
|
1000 |
02BE: MOVWF 40 |
|
|
1001 |
02BF: CALL 106 |
|
|
1002 |
02C0: MOVLW 06 |
|
|
1003 |
02C1: SUBWF 3C,W |
|
|
1004 |
02C2: BTFSS 03.2 |
|
|
1005 |
02C3: GOTO 2BB |
|
|
1006 |
02C4: MOVF 34,W |
|
|
1007 |
02C5: MOVWF 3E |
|
|
1008 |
02C6: MOVLW 10 |
|
|
1009 |
02C7: MOVWF 3F |
|
|
1010 |
02C8: CALL 19D |
|
|
1011 |
02C9: MOVLW 6D |
|
|
1012 |
02CA: MOVWF 40 |
|
|
1013 |
02CB: CALL 106 |
|
|
1014 |
02CC: MOVLW 73 |
|
|
1015 |
02CD: MOVWF 40 |
|
|
1016 |
02CE: CALL 106 |
|
|
1017 |
02CF: MOVLW 20 |
|
|
1018 |
02D0: MOVWF 40 |
|
|
1019 |
02D1: CALL 106 |
|
|
1020 |
.................... delay_ms(10); // prodleva pro terminal |
|
|
1021 |
02D2: MOVLW 0A |
|
|
1022 |
02D3: MOVWF 3C |
|
|
1023 |
02D4: CALL 0EF |
|
|
1024 |
.................... |
|
|
1025 |
.................... // Uvodni pauza |
|
|
1026 |
.................... if (Start==0) // spousti se 1x na zacatku |
|
|
1027 |
02D5: MOVF 35,F |
|
|
1028 |
02D6: BTFSS 03.2 |
|
|
1029 |
02D7: GOTO 2DE |
|
|
1030 |
.................... { |
|
|
1031 |
.................... Start++; // dalsi stav je cekani |
|
|
1032 |
02D8: INCF 35,F |
|
|
1033 |
.................... TimerSet(2000); // na dokonceni uvodni prodlevy |
|
|
1034 |
02D9: MOVLW 07 |
|
|
1035 |
02DA: MOVWF 3D |
|
|
1036 |
02DB: MOVLW D0 |
|
|
1037 |
02DC: MOVWF 3C |
|
|
1038 |
02DD: CALL 1DB |
|
|
1039 |
.................... } |
|
|
1040 |
.................... |
|
|
1041 |
.................... // Rozjezd |
|
|
1042 |
.................... if ((Start==1) && TimerIf()) |
|
|
1043 |
02DE: DECFSZ 35,W |
|
|
1044 |
02DF: GOTO 2F0 |
|
|
1045 |
02E0: CALL 1E2 |
|
|
1046 |
02E1: MOVF 78,F |
|
|
1047 |
02E2: BTFSC 03.2 |
|
|
1048 |
02E3: GOTO 2F0 |
|
|
1049 |
.................... { |
|
|
1050 |
.................... Start++; |
|
|
1051 |
02E4: INCF 35,F |
|
|
1052 |
.................... printf(Putc,"R"); |
|
|
1053 |
02E5: MOVLW 52 |
|
|
1054 |
02E6: MOVWF 40 |
|
|
1055 |
02E7: CALL 106 |
|
|
1056 |
.................... MotorStart(Data); // rozjezd s nastavenim prodlevy |
|
|
1057 |
02E8: MOVF 34,W |
|
|
1058 |
02E9: MOVWF 3C |
|
|
1059 |
02EA: CALL 1F2 |
|
|
1060 |
.................... |
|
|
1061 |
.................... TimerSet(2000); // nastav celkovy cas jizdy |
|
|
1062 |
02EB: MOVLW 07 |
|
|
1063 |
02EC: MOVWF 3D |
|
|
1064 |
02ED: MOVLW D0 |
|
|
1065 |
02EE: MOVWF 3C |
|
|
1066 |
02EF: CALL 1DB |
|
|
1067 |
.................... } |
|
|
1068 |
.................... |
|
|
1069 |
.................... // Zastaveni |
|
|
1070 |
.................... if ((Start==2) && TimerIf()) |
|
|
1071 |
02F0: MOVF 35,W |
|
|
1072 |
02F1: SUBLW 02 |
|
|
1073 |
02F2: BTFSS 03.2 |
|
|
1074 |
02F3: GOTO 2FE |
|
|
1075 |
02F4: CALL 1E2 |
|
|
1076 |
02F5: MOVF 78,F |
|
|
1077 |
02F6: BTFSC 03.2 |
|
|
1078 |
02F7: GOTO 2FE |
|
|
1079 |
.................... { |
|
|
1080 |
.................... Start++; |
|
|
1081 |
02F8: INCF 35,F |
|
|
1082 |
.................... printf(Putc,"S"); |
|
|
1083 |
02F9: MOVLW 53 |
|
|
1084 |
02FA: MOVWF 40 |
|
|
1085 |
02FB: CALL 106 |
|
|
1086 |
.................... MotorSet(0); // pokud dobehl casovac zastav motor |
|
|
1087 |
02FC: CLRF 3C |
|
|
1088 |
02FD: CALL 1CF |
|
|
1089 |
.................... } |
|
|
1090 |
.................... |
|
|
1091 |
.................... // watch dog |
|
|
1092 |
.................... restart_wdt(); |
|
|
1093 |
02FE: CLRWDT |
|
|
1094 |
.................... } |
|
|
1095 |
02FF: GOTO 2B5 |
|
|
1096 |
.................... } |
|
|
1097 |
.................... |
|
|
1098 |
.................... // Test nabijeciho algoritmu |
|
|
1099 |
.................... if (Debug==3) |
|
|
1100 |
0300: MOVF 2F,W |
|
|
1101 |
0301: SUBLW 03 |
|
|
1102 |
0302: BTFSS 03.2 |
|
|
1103 |
0303: GOTO 35A |
|
|
1104 |
.................... { |
|
|
1105 |
.................... unsigned int8 PwmOut; // akcni hodnota pro PWM |
|
|
1106 |
.................... unsigned int8 Req; // pozadovana hodnota z P1 |
|
|
1107 |
.................... unsigned int8 Vref; // merena hodnota vref |
|
|
1108 |
.................... |
|
|
1109 |
.................... // Inicializace stavove promenne |
|
|
1110 |
.................... PwmOut=0; |
|
|
1111 |
0304: CLRF 36 |
|
|
1112 |
.................... |
|
|
1113 |
.................... // Hlavni smycka |
|
|
1114 |
.................... while (1) |
|
|
1115 |
.................... { |
|
|
1116 |
.................... // watch dog |
|
|
1117 |
.................... restart_wdt(); |
|
|
1118 |
0305: CLRWDT |
|
|
1119 |
.................... |
|
|
1120 |
.................... // pozadovana hodnota (potenciometr P1) |
|
|
1121 |
.................... Req=ReadAD(0); |
|
|
1122 |
0306: CLRF 3C |
|
|
1123 |
0307: CALL 178 |
|
|
1124 |
0308: MOVF 78,W |
|
|
1125 |
0309: MOVWF 37 |
|
|
1126 |
.................... Req=50+(ReadAD(0)>>1); // 50 az 177 |
|
|
1127 |
030A: CLRF 3C |
|
|
1128 |
030B: CALL 178 |
|
|
1129 |
030C: BCF 03.0 |
|
|
1130 |
030D: RRF 78,W |
|
|
1131 |
030E: MOVWF 77 |
|
|
1132 |
030F: ADDLW 32 |
|
|
1133 |
0310: MOVWF 37 |
|
|
1134 |
.................... |
|
|
1135 |
.................... // napeti na napajeni (vref) |
|
|
1136 |
.................... Vref=ReadAD(4); |
|
|
1137 |
0311: MOVLW 04 |
|
|
1138 |
0312: MOVWF 3C |
|
|
1139 |
0313: CALL 178 |
|
|
1140 |
0314: MOVF 78,W |
|
|
1141 |
0315: MOVWF 38 |
|
|
1142 |
.................... |
|
|
1143 |
.................... // ricici algoritmus |
|
|
1144 |
.................... if ((Vref<Req) &&(PwmOut<30)) PwmOut++; |
|
|
1145 |
0316: MOVF 37,W |
|
|
1146 |
0317: SUBWF 38,W |
|
|
1147 |
0318: BTFSC 03.0 |
|
|
1148 |
0319: GOTO 31F |
|
|
1149 |
031A: MOVF 36,W |
|
|
1150 |
031B: SUBLW 1D |
|
|
1151 |
031C: BTFSS 03.0 |
|
|
1152 |
031D: GOTO 31F |
|
|
1153 |
031E: INCF 36,F |
|
|
1154 |
.................... if ((Vref>=Req)&&(PwmOut> 0)) PwmOut--; |
|
|
1155 |
031F: MOVF 37,W |
|
|
1156 |
0320: SUBWF 38,W |
|
|
1157 |
0321: BTFSS 03.0 |
|
|
1158 |
0322: GOTO 327 |
|
|
1159 |
0323: MOVF 36,F |
|
|
1160 |
0324: BTFSC 03.2 |
|
|
1161 |
0325: GOTO 327 |
|
|
1162 |
0326: DECF 36,F |
|
|
1163 |
.................... Vref+=10; |
|
|
1164 |
0327: MOVLW 0A |
|
|
1165 |
0328: ADDWF 38,F |
|
|
1166 |
.................... if ((Vref<(Req))&&(PwmOut<30)) PwmOut++; // urychleni nabehu |
|
|
1167 |
0329: MOVF 37,W |
|
|
1168 |
032A: SUBWF 38,W |
|
|
1169 |
032B: BTFSC 03.0 |
|
|
1170 |
032C: GOTO 332 |
|
|
1171 |
032D: MOVF 36,W |
|
|
1172 |
032E: SUBLW 1D |
|
|
1173 |
032F: BTFSS 03.0 |
|
|
1174 |
0330: GOTO 332 |
|
|
1175 |
0331: INCF 36,F |
|
|
1176 |
.................... |
|
|
1177 |
.................... // nastaveni parametru PWM |
|
|
1178 |
.................... if (PwmOut>24) PwmOut=24; // saturace |
|
|
1179 |
0332: MOVF 36,W |
|
|
1180 |
0333: SUBLW 18 |
|
|
1181 |
0334: BTFSC 03.0 |
|
|
1182 |
0335: GOTO 338 |
|
|
1183 |
0336: MOVLW 18 |
|
|
1184 |
0337: MOVWF 36 |
|
|
1185 |
.................... CCPR1L = PwmOut; // pouziti vystupu |
|
|
1186 |
0338: MOVF 36,W |
|
|
1187 |
0339: MOVWF 15 |
|
|
1188 |
.................... |
|
|
1189 |
.................... // zobrazeni |
|
|
1190 |
.................... printf(Putc,"\nALG:%03u %03u %03u",Req,Vref,PwmOut); |
|
|
1191 |
* |
|
|
1192 |
007E: BCF 0A.0 |
|
|
1193 |
007F: BCF 0A.1 |
|
|
1194 |
0080: BCF 0A.2 |
|
|
1195 |
0081: ADDWF 02,F |
|
|
1196 |
0082: RETLW 0A |
|
|
1197 |
0083: RETLW 41 |
|
|
1198 |
0084: RETLW 4C |
|
|
1199 |
0085: RETLW 47 |
|
|
1200 |
0086: RETLW 3A |
|
|
1201 |
0087: RETLW 25 |
|
|
1202 |
0088: RETLW 30 |
|
|
1203 |
0089: RETLW 33 |
|
|
1204 |
008A: RETLW 75 |
|
|
1205 |
008B: RETLW 20 |
|
|
1206 |
008C: RETLW 25 |
|
|
1207 |
008D: RETLW 30 |
|
|
1208 |
008E: RETLW 33 |
|
|
1209 |
008F: RETLW 75 |
|
|
1210 |
0090: RETLW 20 |
|
|
1211 |
0091: RETLW 25 |
|
|
1212 |
0092: RETLW 30 |
|
|
1213 |
0093: RETLW 33 |
|
|
1214 |
0094: RETLW 75 |
|
|
1215 |
0095: RETLW 00 |
|
|
1216 |
* |
|
|
1217 |
033A: CLRF 3C |
|
|
1218 |
033B: MOVF 3C,W |
|
|
1219 |
033C: CALL 07E |
|
|
1220 |
033D: INCF 3C,F |
|
|
1221 |
033E: MOVWF 40 |
|
|
1222 |
033F: CALL 106 |
|
|
1223 |
0340: MOVLW 05 |
|
|
1224 |
0341: SUBWF 3C,W |
|
|
1225 |
0342: BTFSS 03.2 |
|
|
1226 |
0343: GOTO 33B |
|
|
1227 |
0344: MOVF 37,W |
|
|
1228 |
0345: MOVWF 3E |
|
|
1229 |
0346: CLRF 3F |
|
|
1230 |
0347: CALL 19D |
|
|
1231 |
0348: MOVLW 20 |
|
|
1232 |
0349: MOVWF 40 |
|
|
1233 |
034A: CALL 106 |
|
|
1234 |
034B: MOVF 38,W |
|
|
1235 |
034C: MOVWF 3E |
|
|
1236 |
034D: CLRF 3F |
|
|
1237 |
034E: CALL 19D |
|
|
1238 |
034F: MOVLW 20 |
|
|
1239 |
0350: MOVWF 40 |
|
|
1240 |
0351: CALL 106 |
|
|
1241 |
0352: MOVF 36,W |
|
|
1242 |
0353: MOVWF 3E |
|
|
1243 |
0354: CLRF 3F |
|
|
1244 |
0355: CALL 19D |
|
|
1245 |
.................... delay_ms(10); |
|
|
1246 |
0356: MOVLW 0A |
|
|
1247 |
0357: MOVWF 3C |
|
|
1248 |
0358: CALL 0EF |
|
|
1249 |
.................... } |
|
|
1250 |
0359: GOTO 305 |
|
|
1251 |
.................... } |
|
|
1252 |
.................... |
|
|
1253 |
.................... // Standardni beh |
|
|
1254 |
.................... if (Debug==0) |
|
|
1255 |
035A: MOVF 2F,F |
|
|
1256 |
035B: BTFSS 03.2 |
|
|
1257 |
035C: GOTO 3C3 |
|
|
1258 |
.................... { |
|
|
1259 |
.................... unsigned int8 PwmOut; // akcni hodnota pro PWM |
|
|
1260 |
.................... unsigned int8 Req; // pozadovana hodnota z P1 |
|
|
1261 |
.................... unsigned int8 Vref; // merena hodnota vref |
|
|
1262 |
.................... int1 Run; |
|
|
1263 |
.................... |
|
|
1264 |
.................... // Inicializace stavove promenne |
|
|
1265 |
.................... PwmOut=0; |
|
|
1266 |
035D: CLRF 39 |
|
|
1267 |
.................... TimerSet(14000); // casovani startu |
|
|
1268 |
035E: MOVLW 36 |
|
|
1269 |
035F: MOVWF 3D |
|
|
1270 |
0360: MOVLW B0 |
|
|
1271 |
0361: MOVWF 3C |
|
|
1272 |
0362: CALL 1DB |
|
|
1273 |
.................... Run=1; |
|
|
1274 |
0363: BSF 31.1 |
|
|
1275 |
.................... |
|
|
1276 |
.................... // Hlavni smycka |
|
|
1277 |
.................... while (1) |
|
|
1278 |
.................... { |
|
|
1279 |
.................... // watch dog |
|
|
1280 |
.................... restart_wdt(); |
|
|
1281 |
0364: CLRWDT |
|
|
1282 |
.................... |
|
|
1283 |
.................... // pozadovana hodnota (potenciometr P1) |
|
|
1284 |
.................... Req=ReadAD(0); |
|
|
1285 |
0365: CLRF 3C |
|
|
1286 |
0366: CALL 178 |
|
|
1287 |
0367: MOVF 78,W |
|
|
1288 |
0368: MOVWF 3A |
|
|
1289 |
.................... Req=50+(ReadAD(0)>>1); // 50 az 177 |
|
|
1290 |
0369: CLRF 3C |
|
|
1291 |
036A: CALL 178 |
|
|
1292 |
036B: BCF 03.0 |
|
|
1293 |
036C: RRF 78,W |
|
|
1294 |
036D: MOVWF 77 |
|
|
1295 |
036E: ADDLW 32 |
|
|
1296 |
036F: MOVWF 3A |
|
|
1297 |
.................... |
|
|
1298 |
.................... // napeti na napajeni (vref) |
|
|
1299 |
.................... Vref=ReadAD(4); |
|
|
1300 |
0370: MOVLW 04 |
|
|
1301 |
0371: MOVWF 3C |
|
|
1302 |
0372: CALL 178 |
|
|
1303 |
0373: MOVF 78,W |
|
|
1304 |
0374: MOVWF 3B |
|
|
1305 |
.................... |
|
|
1306 |
.................... // ricici algoritmus |
|
|
1307 |
.................... if ((Vref<Req) &&(PwmOut<30)) PwmOut++; |
|
|
1308 |
0375: MOVF 3A,W |
|
|
1309 |
0376: SUBWF 3B,W |
|
|
1310 |
0377: BTFSC 03.0 |
|
|
1311 |
0378: GOTO 37E |
|
|
1312 |
0379: MOVF 39,W |
|
|
1313 |
037A: SUBLW 1D |
|
|
1314 |
037B: BTFSS 03.0 |
|
|
1315 |
037C: GOTO 37E |
|
|
1316 |
037D: INCF 39,F |
|
|
1317 |
.................... if ((Vref>=Req)&&(PwmOut> 0)) PwmOut--; |
|
|
1318 |
037E: MOVF 3A,W |
|
|
1319 |
037F: SUBWF 3B,W |
|
|
1320 |
0380: BTFSS 03.0 |
|
|
1321 |
0381: GOTO 386 |
|
|
1322 |
0382: MOVF 39,F |
|
|
1323 |
0383: BTFSC 03.2 |
|
|
1324 |
0384: GOTO 386 |
|
|
1325 |
0385: DECF 39,F |
|
|
1326 |
.................... Vref+=10; |
|
|
1327 |
0386: MOVLW 0A |
|
|
1328 |
0387: ADDWF 3B,F |
|
|
1329 |
.................... if ((Vref<(Req))&&(PwmOut<30)) PwmOut++; // urychleni nabehu |
|
|
1330 |
0388: MOVF 3A,W |
|
|
1331 |
0389: SUBWF 3B,W |
|
|
1332 |
038A: BTFSC 03.0 |
|
|
1333 |
038B: GOTO 391 |
|
|
1334 |
038C: MOVF 39,W |
|
|
1335 |
038D: SUBLW 1D |
|
|
1336 |
038E: BTFSS 03.0 |
|
|
1337 |
038F: GOTO 391 |
|
|
1338 |
0390: INCF 39,F |
|
|
1339 |
.................... |
|
|
1340 |
.................... // nastaveni parametru PWM |
|
|
1341 |
.................... if (PwmOut>24) PwmOut=24; // saturace |
|
|
1342 |
0391: MOVF 39,W |
|
|
1343 |
0392: SUBLW 18 |
|
|
1344 |
0393: BTFSC 03.0 |
|
|
1345 |
0394: GOTO 397 |
|
|
1346 |
0395: MOVLW 18 |
|
|
1347 |
0396: MOVWF 39 |
|
|
1348 |
.................... CCPR1L = PwmOut; // pouziti vystupu |
|
|
1349 |
0397: MOVF 39,W |
|
|
1350 |
0398: MOVWF 15 |
|
|
1351 |
.................... |
|
|
1352 |
.................... // zobrazeni |
|
|
1353 |
.................... printf(Putc,"\nALG:%03u %03u %03u",Req,Vref,PwmOut); |
|
|
1354 |
0399: CLRF 3C |
|
|
1355 |
039A: MOVF 3C,W |
|
|
1356 |
039B: CALL 07E |
|
|
1357 |
039C: INCF 3C,F |
|
|
1358 |
039D: MOVWF 40 |
|
|
1359 |
039E: CALL 106 |
|
|
1360 |
039F: MOVLW 05 |
|
|
1361 |
03A0: SUBWF 3C,W |
|
|
1362 |
03A1: BTFSS 03.2 |
|
|
1363 |
03A2: GOTO 39A |
|
|
1364 |
03A3: MOVF 3A,W |
|
|
1365 |
03A4: MOVWF 3E |
|
|
1366 |
03A5: CLRF 3F |
|
|
1367 |
03A6: CALL 19D |
|
|
1368 |
03A7: MOVLW 20 |
|
|
1369 |
03A8: MOVWF 40 |
|
|
1370 |
03A9: CALL 106 |
|
|
1371 |
03AA: MOVF 3B,W |
|
|
1372 |
03AB: MOVWF 3E |
|
|
1373 |
03AC: CLRF 3F |
|
|
1374 |
03AD: CALL 19D |
|
|
1375 |
03AE: MOVLW 20 |
|
|
1376 |
03AF: MOVWF 40 |
|
|
1377 |
03B0: CALL 106 |
|
|
1378 |
03B1: MOVF 39,W |
|
|
1379 |
03B2: MOVWF 3E |
|
|
1380 |
03B3: CLRF 3F |
|
|
1381 |
03B4: CALL 19D |
|
|
1382 |
.................... delay_ms(10); |
|
|
1383 |
03B5: MOVLW 0A |
|
|
1384 |
03B6: MOVWF 3C |
|
|
1385 |
03B7: CALL 0EF |
|
|
1386 |
.................... |
|
|
1387 |
.................... // rozjezd |
|
|
1388 |
.................... if (TimerIf()&&Run) |
|
|
1389 |
03B8: CALL 1E2 |
|
|
1390 |
03B9: MOVF 78,F |
|
|
1391 |
03BA: BTFSC 03.2 |
|
|
1392 |
03BB: GOTO 3C2 |
|
|
1393 |
03BC: BTFSS 31.1 |
|
|
1394 |
03BD: GOTO 3C2 |
|
|
1395 |
.................... { |
|
|
1396 |
.................... Run=0; |
|
|
1397 |
03BE: BCF 31.1 |
|
|
1398 |
.................... MotorStart(65); |
|
|
1399 |
03BF: MOVLW 41 |
|
|
1400 |
03C0: MOVWF 3C |
|
|
1401 |
03C1: CALL 1F2 |
|
|
1402 |
.................... } |
|
|
1403 |
.................... } |
|
|
1404 |
03C2: GOTO 364 |
|
|
1405 |
.................... } |
|
|
1406 |
.................... } |
|
|
1407 |
.................... |
|
|
1408 |
03C3: SLEEP |