Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
178 kaklik 1
CCS PCM C Compiler, Version 3.245, 27853               20-IX-06 03:03
2
 
3
               Filename: D:\KAKL\roboti\solarni\2006\scamnum\menic.lst
4
 
5
               ROM used: 769 words (19%)
6
                         Largest free fragment is 2048
7
               RAM used: 76 (43%) at main() level
8
                         82 (47%) worst case
9
               Stack:    3 locations
10
 
11
*
12
0000:  MOVLW  00
13
0001:  MOVWF  0A
14
0002:  GOTO   189
15
0003:  NOP
16
.................... // ************************************* 
17
.................... // * Scamnum Specularis ** 20. 9. 2006 * 
18
.................... // ************************************* 
19
....................  
20
.................... #include ".\menic.h" 
21
.................... #include <16F88.h> 
22
.................... //////// Standard Header file for the PIC16F88 device //////////////// 
23
.................... #device PIC16F88 
24
.................... #list 
25
....................  
26
....................  
27
.................... #device adc=8 
28
....................  
29
.................... #fuses   NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, \ 
30
....................          NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO, CCPB3 
31
....................  
32
.................... #use delay(clock=3900000,RESTART_WDT) 
33
*
34
0004:  MOVLW  66
35
0005:  MOVWF  04
36
0006:  MOVF   00,W
37
0007:  BTFSC  03.2
38
0008:  GOTO   019
39
0009:  MOVLW  01
40
000A:  MOVWF  78
41
000B:  MOVLW  BF
42
000C:  MOVWF  77
43
000D:  CLRWDT
44
000E:  DECFSZ 77,F
45
000F:  GOTO   00D
46
0010:  DECFSZ 78,F
47
0011:  GOTO   00B
48
0012:  MOVLW  42
49
0013:  MOVWF  77
50
0014:  DECFSZ 77,F
51
0015:  GOTO   014
52
0016:  CLRWDT
53
0017:  DECFSZ 00,F
54
0018:  GOTO   009
55
0019:  RETLW  00
56
*
57
0176:  MOVLW  12
58
0177:  SUBWF  66,F
59
0178:  BTFSS  03.0
60
0179:  GOTO   188
61
017A:  MOVLW  66
62
017B:  MOVWF  04
63
017C:  MOVLW  FC
64
017D:  ANDWF  00,F
65
017E:  BCF    03.0
66
017F:  RRF    00,F
67
0180:  RRF    00,F
68
0181:  MOVF   00,W
69
0182:  BTFSC  03.2
70
0183:  GOTO   188
71
0184:  GOTO   186
72
0185:  CLRWDT
73
0186:  DECFSZ 00,F
74
0187:  GOTO   185
75
0188:  RETLW  00
76
....................  
77
....................  
78
....................  
79
.................... #define  TXo PIN_B5           // To the transmitter modulator 
80
.................... #include ".\AX25.c"           // Podprogram pro prenos telemetrie 
81
.................... //#define  PTT PIN_A2                 // PTT control 
82
.................... //#define  TXo PIN_C0                 // To the transmitter modulator 
83
.................... //#define  PERIODAH delay_us(218)     // Halfperiod H 222;78/1200     500;430/500 
84
.................... //#define  TAILH delay_us(74) 
85
.................... //#define  PERIODAL delay_us(408)     // Halfperiod L 412;345/1200    1000;880/500 
86
.................... //#define  TAILL delay_us(341) 
87
.................... #define  PERIODAH delay_us(222)     // Halfperiod H 222;78/1200     500;430/500 
88
.................... #define  TAILH delay_us(78) 
89
.................... #define  PERIODAL delay_us(412)     // Halfperiod L 412;345/1200    1000;880/500 
90
.................... #define  TAILL delay_us(345) 
91
.................... #byte    STATUS = 3                 // CPUs status register 
92
....................  
93
.................... byte SendData[16] = {'A'<<1, 'L'<<1, 'L'<<1, ' '<<1, ' '<<1, ' '<<1,  0x60, 
94
....................                      'C'<<1, 'Z'<<1, '0'<<1, 'R'<<1, 'R'<<1, 'R'<<1, 0x61, 
95
....................                      0x03, 0xF0}; 
96
*
97
0194:  MOVLW  82
98
0195:  BCF    03.5
99
0196:  MOVWF  20
100
0197:  MOVLW  98
101
0198:  MOVWF  21
102
0199:  MOVWF  22
103
019A:  MOVLW  40
104
019B:  MOVWF  23
105
019C:  MOVWF  24
106
019D:  MOVWF  25
107
019E:  MOVLW  60
108
019F:  MOVWF  26
109
01A0:  MOVLW  86
110
01A1:  MOVWF  27
111
01A2:  MOVLW  B4
112
01A3:  MOVWF  28
113
01A4:  MOVLW  60
114
01A5:  MOVWF  29
115
01A6:  MOVLW  A4
116
01A7:  MOVWF  2A
117
01A8:  MOVWF  2B
118
01A9:  MOVWF  2C
119
01AA:  MOVLW  61
120
01AB:  MOVWF  2D
121
01AC:  MOVLW  03
122
01AD:  MOVWF  2E
123
01AE:  MOVLW  F0
124
01AF:  MOVWF  2F
125
....................  
126
.................... boolean bit; 
127
.................... int fcslo, fcshi;    // variabloes for calculating FCS (CRC) 
128
.................... int stuff;           // stuff counter for extra 0 
129
.................... int flag_flag;       // if it is sending flag (7E) 
130
.................... int fcs_flag;        // if it is sending Frame Check Sequence 
131
.................... int i;               // for for 
132
....................  
133
.................... void flipout()       //flips the state of output pin a_1 
134
.................... { 
135
.................... 	stuff = 0;        //since this is a 0, reset the stuff counter 
136
*
137
00A3:  CLRF   33
138
.................... 	if (bit) 
139
00A4:  BTFSS  30.0
140
00A5:  GOTO   0A8
141
....................    { 
142
....................      bit=FALSE;      //if the state of the pin was low, make it high. 
143
00A6:  BCF    30.0
144
....................    } 
145
....................    else 
146
00A7:  GOTO   0A9
147
....................    { 
148
....................      bit=TRUE;	  	   //if the state of the pin was high make it low 
149
00A8:  BSF    30.0
150
....................    } 
151
.................... } 
152
00A9:  RETLW  00
153
....................  
154
.................... void fcsbit(byte tbyte) 
155
.................... { 
156
.................... #asm 
157
....................    BCF    STATUS,0 
158
*
159
0105:  BCF    03.0
160
....................    RRF    fcshi,F             // rotates the entire 16 bits 
161
0106:  RRF    32,F
162
....................    RRF    fcslo,F			      // to the right 
163
0107:  RRF    31,F
164
.................... #endasm 
165
....................    if (((STATUS & 0x01)^(tbyte)) ==0x01) 
166
0108:  MOVF   03,W
167
0109:  ANDLW  01
168
010A:  XORWF  6A,W
169
010B:  SUBLW  01
170
010C:  BTFSS  03.2
171
010D:  GOTO   112
172
....................    { 
173
....................          fcshi = fcshi^0x84; 
174
010E:  MOVLW  84
175
010F:  XORWF  32,F
176
....................          fcslo = fcslo^0x08; 
177
0110:  MOVLW  08
178
0111:  XORWF  31,F
179
....................    } 
180
.................... } 
181
....................  
182
.................... void SendBit () 
183
.................... { 
184
.................... 	if (bit) 
185
*
186
00AA:  BTFSS  30.0
187
00AB:  GOTO   0D6
188
....................    { 
189
....................       output_low(TXo); 
190
00AC:  BSF    03.5
191
00AD:  BCF    06.5
192
00AE:  BCF    03.5
193
00AF:  BCF    06.5
194
....................       PERIODAH; 
195
00B0:  CLRWDT
196
00B1:  MOVLW  47
197
00B2:  MOVWF  77
198
00B3:  DECFSZ 77,F
199
00B4:  GOTO   0B3
200
00B5:  NOP
201
....................       output_high(TXo); 
202
00B6:  BSF    03.5
203
00B7:  BCF    06.5
204
00B8:  BCF    03.5
205
00B9:  BSF    06.5
206
....................       PERIODAH; 
207
00BA:  CLRWDT
208
00BB:  MOVLW  47
209
00BC:  MOVWF  77
210
00BD:  DECFSZ 77,F
211
00BE:  GOTO   0BD
212
00BF:  NOP
213
....................       output_low(TXo); 
214
00C0:  BSF    03.5
215
00C1:  BCF    06.5
216
00C2:  BCF    03.5
217
00C3:  BCF    06.5
218
....................       PERIODAH; 
219
00C4:  CLRWDT
220
00C5:  MOVLW  47
221
00C6:  MOVWF  77
222
00C7:  DECFSZ 77,F
223
00C8:  GOTO   0C7
224
00C9:  NOP
225
....................       output_high(TXo); 
226
00CA:  BSF    03.5
227
00CB:  BCF    06.5
228
00CC:  BCF    03.5
229
00CD:  BSF    06.5
230
....................       TAILH; 
231
00CE:  CLRWDT
232
00CF:  MOVLW  18
233
00D0:  MOVWF  77
234
00D1:  DECFSZ 77,F
235
00D2:  GOTO   0D1
236
00D3:  NOP
237
00D4:  NOP
238
....................     } 
239
....................     else 
240
00D5:  GOTO   0E9
241
....................     { 
242
....................       output_low(TXo); 
243
00D6:  BSF    03.5
244
00D7:  BCF    06.5
245
00D8:  BCF    03.5
246
00D9:  BCF    06.5
247
....................       PERIODAL; 
248
00DA:  CLRWDT
249
00DB:  MOVLW  85
250
00DC:  MOVWF  77
251
00DD:  DECFSZ 77,F
252
00DE:  GOTO   0DD
253
....................       output_high(TXo); 
254
00DF:  BSF    03.5
255
00E0:  BCF    06.5
256
00E1:  BCF    03.5
257
00E2:  BSF    06.5
258
....................       TAILL; 
259
00E3:  CLRWDT
260
00E4:  MOVLW  6F
261
00E5:  MOVWF  77
262
00E6:  DECFSZ 77,F
263
00E7:  GOTO   0E6
264
00E8:  NOP
265
....................     }; 
266
.................... } 
267
00E9:  RETLW  00
268
....................  
269
.................... void SendByte (byte inbyte) 
270
.................... { 
271
....................    int k, bt; 
272
....................  
273
....................    for (k=0;k<8;k++)    //do the following for each of the 8 bits in the byte 
274
00EA:  CLRF   68
275
00EB:  MOVF   68,W
276
00EC:  SUBLW  07
277
00ED:  BTFSS  03.0
278
00EE:  GOTO   132
279
....................    { 
280
....................      bt = inbyte & 0x01;            //strip off the rightmost bit of the byte to be sent (inbyte) 
281
00EF:  MOVF   67,W
282
00F0:  ANDLW  01
283
00F1:  MOVWF  69
284
....................      if ((fcs_flag == FALSE) & (flag_flag == FALSE)) fcsbit(bt);    //do FCS calc, but only if this 
285
00F2:  MOVF   35,F
286
00F3:  BTFSC  03.2
287
00F4:  GOTO   0F7
288
00F5:  MOVLW  00
289
00F6:  GOTO   0F8
290
00F7:  MOVLW  01
291
00F8:  MOVWF  6A
292
00F9:  MOVF   34,F
293
00FA:  BTFSC  03.2
294
00FB:  GOTO   0FE
295
00FC:  MOVLW  00
296
00FD:  GOTO   0FF
297
00FE:  MOVLW  01
298
00FF:  ANDWF  6A,W
299
0100:  XORLW  00
300
0101:  BTFSC  03.2
301
0102:  GOTO   112
302
0103:  MOVF   69,W
303
0104:  MOVWF  6A
304
.................... 						                                                //is not a flag or fcs byte 
305
....................      if (bt == 0) 
306
*
307
0112:  MOVF   69,F
308
0113:  BTFSS  03.2
309
0114:  GOTO   117
310
....................      { 
311
....................        flipout(); 
312
0115:  CALL   0A3
313
....................      }  			               // if this bit is a zero, flip the output state 
314
....................      else 
315
0116:  GOTO   12D
316
....................      {                          			      //otherwise if it is a 1, do the following: 
317
....................        if (flag_flag == FALSE) stuff++;      //increment the count of consequtive 1's 
318
0117:  MOVF   34,F
319
0118:  BTFSC  03.2
320
0119:  INCF   33,F
321
....................        if ((flag_flag == FALSE) & (stuff == 5)) 
322
011A:  MOVF   34,F
323
011B:  BTFSC  03.2
324
011C:  GOTO   11F
325
011D:  MOVLW  00
326
011E:  GOTO   120
327
011F:  MOVLW  01
328
0120:  MOVWF  6A
329
0121:  MOVF   33,W
330
0122:  SUBLW  05
331
0123:  BTFSC  03.2
332
0124:  GOTO   127
333
0125:  MOVLW  00
334
0126:  GOTO   128
335
0127:  MOVLW  01
336
0128:  ANDWF  6A,W
337
0129:  BTFSC  03.2
338
012A:  GOTO   12D
339
....................        {       //stuff an extra 0, if 5 1's in a row 
340
....................          SendBit(); 
341
012B:  CALL   0AA
342
....................          flipout();               //flip the output state to stuff a 0 
343
012C:  CALL   0A3
344
....................        }//end of if 
345
....................      }//end of else 
346
....................      // delay_us(850);				 //introduces a delay that creates 1200 baud 
347
....................      SendBit(); 
348
012D:  CALL   0AA
349
....................      inbyte = inbyte>>1;          //go to the next bit in the byte 
350
012E:  BCF    03.0
351
012F:  RRF    67,F
352
....................    }//end of for 
353
0130:  INCF   68,F
354
0131:  GOTO   0EB
355
.................... }//end of SendByte 
356
0132:  RETLW  00
357
....................  
358
.................... void SendPacket(char *data) 
359
.................... { 
360
....................     bit=FALSE; 
361
0133:  BCF    30.0
362
....................  
363
....................    fcslo=fcshi=0xFF;       //The 2 FCS Bytes are initialized to FF 
364
0134:  MOVLW  FF
365
0135:  MOVWF  32
366
0136:  MOVWF  31
367
....................    stuff = 0;              //The variable stuff counts the number of 1's in a row. When it gets to 5 
368
0137:  CLRF   33
369
.................... 		                     // it is time to stuff a 0. 
370
....................  
371
.................... //   output_low(PTT);        // Blinking LED 
372
.................... //   delay_ms(1000); 
373
.................... //   output_high(PTT); 
374
....................  
375
....................    flag_flag = TRUE;       //The variable flag is true if you are transmitted flags (7E's) false otherwise. 
376
0138:  MOVLW  01
377
0139:  MOVWF  34
378
....................    fcs_flag = FALSE;       //The variable fcsflag is true if you are transmitting FCS bytes, false otherwise. 
379
013A:  CLRF   35
380
....................  
381
....................    for(i=0; i<10; i++) SendByte(0x7E); //Sends flag bytes.  Adjust length for txdelay 
382
013B:  CLRF   36
383
013C:  MOVF   36,W
384
013D:  SUBLW  09
385
013E:  BTFSS  03.0
386
013F:  GOTO   145
387
0140:  MOVLW  7E
388
0141:  MOVWF  67
389
0142:  CALL   0EA
390
0143:  INCF   36,F
391
0144:  GOTO   13C
392
....................                                        //each flag takes approx 6.7 ms 
393
....................    flag_flag = FALSE;      //done sending flags 
394
0145:  CLRF   34
395
....................  
396
....................    for(i=0; i<16; i++) SendByte(SendData[i]);      //send the packet bytes 
397
0146:  CLRF   36
398
0147:  MOVF   36,W
399
0148:  SUBLW  0F
400
0149:  BTFSS  03.0
401
014A:  GOTO   154
402
014B:  MOVLW  20
403
014C:  ADDWF  36,W
404
014D:  MOVWF  04
405
014E:  MOVF   00,W
406
014F:  MOVWF  66
407
0150:  MOVWF  67
408
0151:  CALL   0EA
409
0152:  INCF   36,F
410
0153:  GOTO   147
411
....................  
412
....................    for(i=0; 0 != *data; i++) 
413
0154:  CLRF   36
414
0155:  MOVF   65,W
415
0156:  MOVWF  04
416
0157:  MOVF   00,W
417
0158:  BTFSC  03.2
418
0159:  GOTO   163
419
....................    { 
420
....................       SendByte(*data);     //send the packet bytes 
421
015A:  MOVF   65,W
422
015B:  MOVWF  04
423
015C:  MOVF   00,W
424
015D:  MOVWF  66
425
015E:  MOVWF  67
426
015F:  CALL   0EA
427
....................       data++; 
428
0160:  INCF   65,F
429
....................    }; 
430
0161:  INCF   36,F
431
0162:  GOTO   155
432
....................  
433
....................    fcs_flag = TRUE;       	//about to send the FCS bytes 
434
0163:  MOVLW  01
435
0164:  MOVWF  35
436
....................    fcslo =fcslo^0xff;      //must XOR them with FF before sending 
437
0165:  MOVLW  FF
438
0166:  XORWF  31,F
439
....................    fcshi = fcshi^0xff; 
440
0167:  XORWF  32,F
441
....................    SendByte(fcslo);        //send the low byte of fcs 
442
0168:  MOVF   31,W
443
0169:  MOVWF  67
444
016A:  CALL   0EA
445
....................    SendByte(fcshi);        //send the high byte of fcs 
446
016B:  MOVF   32,W
447
016C:  MOVWF  67
448
016D:  CALL   0EA
449
....................    fcs_flag = FALSE;		   //done sending FCS 
450
016E:  CLRF   35
451
....................    flag_flag = TRUE;  		//about to send flags 
452
016F:  MOVLW  01
453
0170:  MOVWF  34
454
....................    SendByte(0x7e);         // Send a flag to end packet 
455
0171:  MOVLW  7E
456
0172:  MOVWF  67
457
0173:  CALL   0EA
458
.................... } 
459
0174:  BCF    0A.3
460
0175:  GOTO   2C2 (RETURN)
461
....................  
462
....................  
463
....................  
464
....................  
465
.................... char AXstring[40];            // Buffer pro prenos telemetrie 
466
....................  
467
.................... #define REFSTART  95    // Hodnota odpovidajici 1,2V pri nezatizenych clancich 
468
.................... #define DUTY1     2     // Delka sepnuti PWM v us pro sero 
469
.................... #define DUTY2     19    // Delka sepnuti PWM v us pro jednu zarovku 500W 
470
....................  
471
.................... // Tabulka hodnot prevodniku pro ruzna napajeci napeti 
472
.................... //  80   3,99V 
473
.................... //  90   3,54V 
474
.................... // 100   3,20V 
475
.................... // 105   3,04V 
476
.................... // 107   2,99V 
477
.................... // 110   2,91v 
478
.................... // 200   1,61V 
479
....................  
480
.................... #define PIEZO     PIN_A6   // Jeden pol piezo reproduktoru 
481
.................... #define LED       PIN_A7   // LED / druhy pol piezo reproduktoru 
482
.................... #define MENIC     PIN_B3   // Spinani tranzistoru menice 
483
.................... #define REFPWR    PIN_B1   // Napajeni zdroje referencniho napeti 
484
.................... #define MOTOR     PIN_B2   // Spinani tranzistoru motoru 
485
.................... #define SW1       PIN_B6   // DIPswitch 1 
486
.................... #define SW2       PIN_B7   // DIPswitch 2 
487
.................... #define NAPETI    4        // Cislo kanalu DA prevodniku pro mereni napeti 
488
.................... #define PWM       0        // Cislo kanalu DA prevodniku pro nastaveni PWM 
489
.................... #define ROZJEZD   1        // Cislo kanalu DA prevodniku pro nastaveni rozjezdu 
490
....................  
491
.................... void pip()     // pipnuti a bliknuti 
492
.................... { 
493
....................    int1 beep; 
494
....................    int i; 
495
....................  
496
....................    for(i=0; i<250; i++) 
497
*
498
0027:  CLRF   66
499
0028:  MOVF   66,W
500
0029:  SUBLW  F9
501
002A:  BTFSS  03.0
502
002B:  GOTO   047
503
....................    { 
504
....................       output_bit(PIEZO, beep); 
505
002C:  BTFSC  65.0
506
002D:  GOTO   030
507
002E:  BCF    05.6
508
002F:  GOTO   031
509
0030:  BSF    05.6
510
0031:  BSF    03.5
511
0032:  BCF    05.6
512
....................       beep=~beep; 
513
0033:  MOVLW  01
514
0034:  BCF    03.5
515
0035:  XORWF  65,F
516
....................       output_bit(LED, beep); 
517
0036:  BTFSC  65.0
518
0037:  GOTO   03A
519
0038:  BCF    05.7
520
0039:  GOTO   03B
521
003A:  BSF    05.7
522
003B:  BSF    03.5
523
003C:  BCF    05.7
524
....................       delay_us(100); 
525
003D:  CLRWDT
526
003E:  MOVLW  1F
527
003F:  MOVWF  77
528
0040:  DECFSZ 77,F
529
0041:  GOTO   040
530
0042:  NOP
531
0043:  NOP
532
....................    }; 
533
0044:  BCF    03.5
534
0045:  INCF   66,F
535
0046:  GOTO   028
536
....................    output_high(PIEZO); 
537
0047:  BSF    03.5
538
0048:  BCF    05.6
539
0049:  BCF    03.5
540
004A:  BSF    05.6
541
....................    output_high(LED); 
542
004B:  BSF    03.5
543
004C:  BCF    05.7
544
004D:  BCF    03.5
545
004E:  BSF    05.7
546
.................... } 
547
004F:  BCF    0A.3
548
0050:  GOTO   276 (RETURN)
549
....................  
550
.................... void cvak()    // pouze cvaknuti piezoelementem bez bliknuti 
551
.................... { 
552
....................    output_bit(PIEZO,~input(PIEZO)); 
553
*
554
001A:  BSF    03.5
555
001B:  BSF    05.6
556
001C:  BCF    03.5
557
001D:  BTFSS  05.6
558
001E:  GOTO   021
559
001F:  BCF    05.6
560
0020:  GOTO   022
561
0021:  BSF    05.6
562
0022:  BSF    03.5
563
0023:  BCF    05.6
564
.................... } 
565
0024:  BCF    03.5
566
0025:  BCF    0A.3
567
0026:  GOTO   229 (RETURN)
568
....................  
569
.................... void main() 
570
.................... { 
571
*
572
0189:  CLRF   04
573
018A:  MOVLW  1F
574
018B:  ANDWF  03,F
575
018C:  BSF    03.5
576
018D:  BCF    1F.4
577
018E:  BCF    1F.5
578
018F:  MOVF   1B,W
579
0190:  ANDLW  80
580
0191:  MOVWF  1B
581
0192:  MOVLW  07
582
0193:  MOVWF  1C
583
....................    int8 n; 
584
....................    int8 perioda; 
585
....................    int8 razeni; 
586
....................    int8 uclanku; 
587
....................    int8 ble; 
588
....................  
589
....................    setup_timer_0(RTCC_INTERNAL);setup_wdt(WDT_1152MS); 
590
*
591
01B1:  BSF    03.5
592
01B2:  MOVF   01,W
593
01B3:  ANDLW  C0
594
01B4:  MOVWF  01
595
01B5:  MOVLW  0E
596
01B6:  MOVWF  77
597
01B7:  MOVLW  07
598
01B8:  BCF    03.5
599
01B9:  CLRF   01
600
01BA:  MOVLW  81
601
01BB:  MOVWF  04
602
01BC:  MOVF   00,W
603
01BD:  ANDLW  F0
604
01BE:  IORLW  07
605
01BF:  MOVWF  00
606
01C0:  CLRWDT
607
01C1:  MOVF   00,W
608
01C2:  ANDLW  F7
609
01C3:  BTFSC  77.3
610
01C4:  ANDLW  F0
611
01C5:  IORWF  77,W
612
01C6:  MOVWF  00
613
....................    setup_timer_1(T1_DISABLED); 
614
01C7:  CLRF   10
615
....................    setup_adc_ports(ADC_CLOCK_INTERNAL|sAN0|sAN1|sAN4|VSS_VDD); 
616
01C8:  BSF    03.5
617
01C9:  BCF    1F.4
618
01CA:  BCF    1F.5
619
01CB:  MOVF   1B,W
620
01CC:  ANDLW  80
621
01CD:  IORLW  D3
622
01CE:  MOVWF  1B
623
....................    setup_adc(ADC_CLOCK_INTERNAL); 
624
01CF:  BCF    1F.6
625
01D0:  BCF    03.5
626
01D1:  BSF    1F.6
627
01D2:  BSF    1F.7
628
01D3:  BSF    03.5
629
01D4:  BCF    1F.7
630
01D5:  BCF    03.5
631
01D6:  BSF    1F.0
632
....................    setup_spi(FALSE); 
633
01D7:  BCF    14.5
634
01D8:  BSF    03.5
635
01D9:  BCF    06.2
636
01DA:  BSF    06.1
637
01DB:  BCF    06.4
638
01DC:  MOVLW  00
639
01DD:  BCF    03.5
640
01DE:  MOVWF  14
641
01DF:  BSF    03.5
642
01E0:  MOVWF  14
643
....................    setup_comparator(NC_NC_NC_NC); 
644
01E1:  MOVLW  07
645
01E2:  MOVWF  1C
646
01E3:  MOVF   05,W
647
01E4:  CLRWDT
648
01E5:  MOVLW  02
649
01E6:  MOVWF  77
650
01E7:  DECFSZ 77,F
651
01E8:  GOTO   1E7
652
01E9:  NOP
653
01EA:  MOVF   1C,W
654
01EB:  BCF    03.5
655
01EC:  BCF    0D.6
656
....................    setup_vref(FALSE); 
657
01ED:  BSF    03.5
658
01EE:  CLRF   1D
659
....................  
660
....................    output_low(MENIC);      // Vsechno zastav 
661
01EF:  BCF    06.3
662
01F0:  BCF    03.5
663
01F1:  BCF    06.3
664
....................    output_low(MOTOR); 
665
01F2:  BSF    03.5
666
01F3:  BCF    06.2
667
01F4:  BCF    03.5
668
01F5:  BCF    06.2
669
....................    output_low(REFPWR); 
670
01F6:  BSF    03.5
671
01F7:  BCF    06.1
672
01F8:  BCF    03.5
673
01F9:  BCF    06.1
674
....................    output_high(LED); 
675
01FA:  BSF    03.5
676
01FB:  BCF    05.7
677
01FC:  BCF    03.5
678
01FD:  BSF    05.7
679
....................    output_high(PIEZO); 
680
01FE:  BSF    03.5
681
01FF:  BCF    05.6
682
0200:  BCF    03.5
683
0201:  BSF    05.6
684
....................  
685
....................    set_adc_channel(NAPETI);     // Vyber AD kanal pro pomerne mereni napeti 
686
0202:  MOVLW  20
687
0203:  MOVWF  78
688
0204:  MOVF   1F,W
689
0205:  ANDLW  C7
690
0206:  IORWF  78,W
691
0207:  MOVWF  1F
692
....................    set_pwm1_duty(0);       // Spust PWM, ale zatim s trvalou 0 na vystupu 
693
0208:  CLRF   15
694
....................    setup_ccp1(CCP_PWM); 
695
0209:  BSF    03.5
696
020A:  BCF    06.3
697
020B:  BCF    03.5
698
020C:  BCF    06.3
699
020D:  MOVLW  0C
700
020E:  MOVWF  17
701
....................    setup_timer_2(T2_DIV_BY_1,100,1);  // perioda 
702
020F:  MOVLW  00
703
0210:  MOVWF  78
704
0211:  IORLW  04
705
0212:  MOVWF  12
706
0213:  MOVLW  64
707
0214:  BSF    03.5
708
0215:  MOVWF  12
709
....................  
710
....................    setup_oscillator(OSC_4MHZ|OSC_INTRC);  // rozjed PIC (zvysi se odber) 
711
0216:  MOVLW  62
712
0217:  MOVWF  0F
713
....................  
714
.................... // jsme v depu? 
715
....................    set_pwm1_duty(DUTY1);          // PWM pro zatizeni clanku pri malem osvetleni 
716
0218:  MOVLW  02
717
0219:  BCF    03.5
718
021A:  MOVWF  15
719
....................    n=0; 
720
021B:  CLRF   60
721
....................    do 
722
....................    { 
723
....................       output_low(REFPWR);  // Vypni napajeni napetove reference, aby se setrilo 
724
021C:  BSF    03.5
725
021D:  BCF    06.1
726
021E:  BCF    03.5
727
021F:  BCF    06.1
728
....................       delay_ms(100); 
729
0220:  MOVLW  64
730
0221:  MOVWF  66
731
0222:  CALL   004
732
....................       if (4==n++) {cvak(); n=0;};   // Kazdy 4. pruchod cvakni 
733
0223:  MOVF   60,W
734
0224:  INCF   60,F
735
0225:  SUBLW  04
736
0226:  BTFSS  03.2
737
0227:  GOTO   22A
738
0228:  GOTO   01A
739
0229:  CLRF   60
740
....................       output_high(REFPWR);          // Zapni napajeni napetove reference 
741
022A:  BSF    03.5
742
022B:  BCF    06.1
743
022C:  BCF    03.5
744
022D:  BSF    06.1
745
....................       delay_ms(1);                  // Pockej na ustaleni napeti 
746
022E:  MOVLW  01
747
022F:  MOVWF  66
748
0230:  CALL   004
749
....................    } while (read_adc()>REFSTART);   // Odkryl starter clanky? 
750
0231:  BSF    1F.2
751
0232:  BTFSC  1F.2
752
0233:  GOTO   232
753
0234:  MOVF   1E,W
754
0235:  SUBLW  5F
755
0236:  BTFSS  03.0
756
0237:  GOTO   21C
757
....................    output_low(REFPWR);     // Vypni napajeni napetove reference, aby se setrilo 
758
0238:  BSF    03.5
759
0239:  BCF    06.1
760
023A:  BCF    03.5
761
023B:  BCF    06.1
762
....................  
763
.................... //   port_b_pullups(TRUE);            // Zapni pullupy, aby slo cist DIPswitch 
764
.................... //   do 
765
.................... //   { 
766
....................       // Precti trimry 
767
....................       set_adc_channel(PWM);         // Zjisteni nastaveni PWM 
768
023C:  MOVLW  00
769
023D:  MOVWF  78
770
023E:  MOVF   1F,W
771
023F:  ANDLW  C7
772
0240:  IORWF  78,W
773
0241:  MOVWF  1F
774
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
775
0242:  CLRWDT
776
0243:  MOVLW  1F
777
0244:  MOVWF  77
778
0245:  DECFSZ 77,F
779
0246:  GOTO   245
780
0247:  NOP
781
0248:  NOP
782
....................       perioda=(read_adc()>>2)+40;   // rozsah: 40 az 103 
783
0249:  BSF    1F.2
784
024A:  BTFSC  1F.2
785
024B:  GOTO   24A
786
024C:  MOVF   1E,W
787
024D:  MOVWF  77
788
024E:  RRF    77,F
789
024F:  RRF    77,F
790
0250:  MOVLW  3F
791
0251:  ANDWF  77,F
792
0252:  MOVF   77,W
793
0253:  ADDLW  28
794
0254:  MOVWF  61
795
....................  
796
....................       set_adc_channel(ROZJEZD);     // Zjisteni nastaveni rozjezdu 
797
0255:  MOVLW  08
798
0256:  MOVWF  78
799
0257:  MOVF   1F,W
800
0258:  ANDLW  C7
801
0259:  IORWF  78,W
802
025A:  MOVWF  1F
803
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
804
025B:  CLRWDT
805
025C:  MOVLW  1F
806
025D:  MOVWF  77
807
025E:  DECFSZ 77,F
808
025F:  GOTO   25E
809
0260:  NOP
810
0261:  NOP
811
....................       razeni=read_adc()>>4;         // rozsah: 0 az 15 
812
0262:  BSF    1F.2
813
0263:  BTFSC  1F.2
814
0264:  GOTO   263
815
0265:  MOVF   1E,W
816
0266:  SWAPF  1E,W
817
0267:  MOVWF  62
818
0268:  MOVLW  0F
819
0269:  ANDWF  62,F
820
....................  
821
....................       // Rozjeti menice 
822
....................       set_pwm1_duty(0);    // Zastav PWM, aby slo nastavit jinou frekvenci 
823
026A:  CLRF   15
824
....................       setup_timer_2(T2_DIV_BY_1,perioda,1);    // perioda 
825
026B:  MOVLW  00
826
026C:  MOVWF  78
827
026D:  IORLW  04
828
026E:  MOVWF  12
829
026F:  MOVF   61,W
830
0270:  BSF    03.5
831
0271:  MOVWF  12
832
....................       set_pwm1_duty(DUTY2); // PWM pro zatizeni clanku pri jedne 500W zarovce 
833
0272:  MOVLW  13
834
0273:  BCF    03.5
835
0274:  MOVWF  15
836
....................  
837
....................       pip();                  // potvrzeni odstartovani / servisni mod 
838
0275:  GOTO   027
839
....................       delay_ms(500); 
840
0276:  MOVLW  02
841
0277:  MOVWF  65
842
0278:  MOVLW  FA
843
0279:  MOVWF  66
844
027A:  CALL   004
845
027B:  DECFSZ 65,F
846
027C:  GOTO   278
847
....................  
848
.................... //   } while (input(SW1));      // Je zapnut servisni mod? SW1(OFF)=ANO 
849
.................... //   port_b_pullups(FALSE);     // Vypni pullupy, aby se setrilo energii 
850
....................  
851
....................    // zmereni napeti na clancich 
852
....................    output_high(REFPWR);          // Prepni AD na mereni napeti clanku 
853
027D:  BSF    03.5
854
027E:  BCF    06.1
855
027F:  BCF    03.5
856
0280:  BSF    06.1
857
....................    set_adc_channel(NAPETI);      // Prepni Zmer napeti clanku 
858
0281:  MOVLW  20
859
0282:  MOVWF  78
860
0283:  MOVF   1F,W
861
0284:  ANDLW  C7
862
0285:  IORWF  78,W
863
0286:  MOVWF  1F
864
....................    delay_us(50);                // Pockej na prepnuti kanalu A/D prevodniku 
865
0287:  CLRWDT
866
0288:  MOVLW  0F
867
0289:  MOVWF  77
868
028A:  DECFSZ 77,F
869
028B:  GOTO   28A
870
028C:  NOP
871
....................    uclanku=read_adc(); 
872
028D:  BSF    1F.2
873
028E:  BTFSC  1F.2
874
028F:  GOTO   28E
875
0290:  MOVF   1E,W
876
0291:  MOVWF  63
877
....................    output_low(REFPWR);     // odpoj odpor pro mereni napeti 
878
0292:  BSF    03.5
879
0293:  BCF    06.1
880
0294:  BCF    03.5
881
0295:  BCF    06.1
882
....................  
883
....................    // posli telemetrii 
884
....................    sprintf(AXstring,"p=%u r=%u u=%u", perioda, razeni, uclanku);  // Convert DATA to String. 
885
*
886
01B0:  CLRF   5F
887
*
888
0296:  MOVLW  37
889
0297:  MOVWF  5F
890
0298:  MOVLW  70
891
0299:  MOVWF  67
892
029A:  CALL   051
893
029B:  MOVLW  3D
894
029C:  MOVWF  67
895
029D:  CALL   051
896
029E:  MOVF   61,W
897
029F:  MOVWF  65
898
02A0:  MOVLW  1B
899
02A1:  MOVWF  66
900
02A2:  CALL   06E
901
02A3:  MOVLW  20
902
02A4:  MOVWF  67
903
02A5:  CALL   051
904
02A6:  MOVLW  72
905
02A7:  MOVWF  67
906
02A8:  CALL   051
907
02A9:  MOVLW  3D
908
02AA:  MOVWF  67
909
02AB:  CALL   051
910
02AC:  MOVF   62,W
911
02AD:  MOVWF  65
912
02AE:  MOVLW  1B
913
02AF:  MOVWF  66
914
02B0:  CALL   06E
915
02B1:  MOVLW  20
916
02B2:  MOVWF  67
917
02B3:  CALL   051
918
02B4:  MOVLW  75
919
02B5:  MOVWF  67
920
02B6:  CALL   051
921
02B7:  MOVLW  3D
922
02B8:  MOVWF  67
923
02B9:  CALL   051
924
02BA:  MOVF   63,W
925
02BB:  MOVWF  65
926
02BC:  MOVLW  1B
927
02BD:  MOVWF  66
928
02BE:  CALL   06E
929
....................    SendPacket(&AXstring[0]); 
930
02BF:  MOVLW  37
931
02C0:  MOVWF  65
932
02C1:  GOTO   133
933
....................  
934
....................    delay_ms(14000);           // Pockame do 14.5s 
935
02C2:  MOVLW  38
936
02C3:  MOVWF  65
937
02C4:  MOVLW  FA
938
02C5:  MOVWF  66
939
02C6:  CALL   004
940
02C7:  DECFSZ 65,F
941
02C8:  GOTO   2C4
942
....................  
943
....................    // rozjezd 
944
....................    for( ble=1;ble<255;ble++) 
945
02C9:  MOVLW  01
946
02CA:  MOVWF  64
947
02CB:  INCFSZ 64,W
948
02CC:  GOTO   2CE
949
02CD:  GOTO   2EF
950
....................    { 
951
....................       for(n=0;n<=razeni;n++) 
952
02CE:  CLRF   60
953
02CF:  MOVF   60,W
954
02D0:  SUBWF  62,W
955
02D1:  BTFSS  03.0
956
02D2:  GOTO   2ED
957
....................       { 
958
....................          output_high(MOTOR); 
959
02D3:  BSF    03.5
960
02D4:  BCF    06.2
961
02D5:  BCF    03.5
962
02D6:  BSF    06.2
963
....................          delay_us(ble); 
964
02D7:  MOVF   64,W
965
02D8:  MOVWF  66
966
02D9:  CALL   176
967
....................          delay_us(ble); 
968
02DA:  MOVF   64,W
969
02DB:  MOVWF  66
970
02DC:  CALL   176
971
....................          output_low(MOTOR); 
972
02DD:  BSF    03.5
973
02DE:  BCF    06.2
974
02DF:  BCF    03.5
975
02E0:  BCF    06.2
976
....................          delay_us(255-ble); 
977
02E1:  MOVF   64,W
978
02E2:  SUBLW  FF
979
02E3:  MOVWF  65
980
02E4:  MOVWF  66
981
02E5:  CALL   176
982
....................          delay_us(255-ble); 
983
02E6:  MOVF   64,W
984
02E7:  SUBLW  FF
985
02E8:  MOVWF  65
986
02E9:  MOVWF  66
987
02EA:  CALL   176
988
....................       } 
989
02EB:  INCF   60,F
990
02EC:  GOTO   2CF
991
....................    } 
992
02ED:  INCF   64,F
993
02EE:  GOTO   2CB
994
....................  
995
.................... // jedem co to da 
996
....................    output_high(MOTOR); 
997
02EF:  BSF    03.5
998
02F0:  BCF    06.2
999
02F1:  BCF    03.5
1000
02F2:  BSF    06.2
1001
....................  
1002
....................    delay_ms(1300);                  // Nemeli bysme jet dele nez 1,3s :-) 
1003
02F3:  MOVLW  0A
1004
02F4:  MOVWF  65
1005
02F5:  MOVLW  82
1006
02F6:  MOVWF  66
1007
02F7:  CALL   004
1008
02F8:  DECFSZ 65,F
1009
02F9:  GOTO   2F5
1010
....................    output_low(MOTOR);               // Zastav motor 
1011
02FA:  BSF    03.5
1012
02FB:  BCF    06.2
1013
02FC:  BCF    03.5
1014
02FD:  BCF    06.2
1015
....................                                     // Menic je stale zapnut a zatezuje clanky 
1016
....................  
1017
....................    reset_cpu();        
1018
02FE:  CLRF   0A
1019
02FF:  GOTO   000
1020
.................... } 
1021
0300:  SLEEP
1022
 
1023
Configuration Fuses:
1024
   Word  1: 2738   NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT DEBUG CCPB3 NOPROTECT INTRC_IO
1025
   Word  2: 3FFC   NOFCMEN NOIESO