Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
2 kaklik 1
CCS PCM C Compiler, Version 3.221, 27853               28-VIII-05 19:00
2
 
3
               Filename: D:\KAKLIK\programy\PIC_C\roboti\solarni\2005\jump\menic.LST
4
 
5
               ROM used: 433 words (11%)
6
                         Largest free fragment is 2048
7
               RAM used: 18 (10%) at main() level
8
                         19 (11%) worst case
9
               Stack:    2 worst case (1 in main + 1 for interrupts)
10
 
11
*
12
0000:  MOVLW  00
13
0001:  MOVWF  0A
14
0002:  GOTO   090
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   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   043
67
....................  #include ".\menic.h" 
68
....................  #include <16F88.h> 
69
....................  //////// Standard Header file for the PIC16F88 device ////////////////  
70
.................... #device PIC16F88  
71
.................... #list  
72
....................  
73
....................   
74
.................... #device adc=8  
75
.................... #fuses NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO, CCPB3  
76
.................... #use delay(clock=4000000)  
77
*
78
0048:  MOVLW  2D
79
0049:  MOVWF  04
80
004A:  MOVF   00,W
81
004B:  BTFSC  03.2
82
004C:  GOTO   05C
83
004D:  MOVLW  01
84
004E:  MOVWF  78
85
004F:  CLRF   77
86
0050:  DECFSZ 77,F
87
0051:  GOTO   050
88
0052:  DECFSZ 78,F
89
0053:  GOTO   04F
90
0054:  MOVLW  4A
91
0055:  MOVWF  77
92
0056:  DECFSZ 77,F
93
0057:  GOTO   056
94
0058:  NOP
95
0059:  NOP
96
005A:  DECFSZ 00,F
97
005B:  GOTO   04D
98
005C:  RETLW  00
99
....................   
100
....................  
101
....................   
102
.................... #define RAZENI    60   // Po kolika ms se bude menit rychlost pro rozjizdeni  
103
.................... #define REFNOM    107   // Hodnota odpovidajici 1,2V pri nominalnim zatizeni  
104
.................... #define REFSTART  80    // Hodnota odpovidajici 1,2V pri nezatizenych clancich  
105
....................   
106
.................... #define PIEZO  PIN_A6   // Jeden pol piezo reproduktoru  
107
.................... #define LED    PIN_A7   // LED  
108
.................... #define MENIC  PIN_B3   // Spinani tranzistoru menice  
109
.................... #define REFPWR PIN_B1   // Napajeni zdroje referencniho napeti  
110
.................... #define MOTOR  PIN_B2   // Spinani tranzistoru motoru  
111
....................   
112
.................... #byte SSPBUF         = 0x13   // Registry jednotky SSP  
113
.................... #byte SSPCON1        = 0x14  
114
.................... #byte SSPSTAT        = 0x94  
115
....................   
116
.................... // Vzorky pro generovani PWM pomoci SSP  
117
.................... unsigned int8 const Pattern[8] = {0x02,0x06,0x0e,0x1e,0x3e,0x7e,0xfe,0xff};  
118
.................... unsigned int8 MotorPattern;  
119
....................   
120
.................... #INT_SSP  
121
.................... void IntSSP()  
122
.................... {  
123
....................    SSPBUF=MotorPattern;             // znovu vysli stejnou hodnotu  
124
*
125
0043:  MOVF   29,W
126
0044:  MOVWF  13
127
.................... }  
128
....................   
129
0045:  BCF    0C.3
130
0046:  BCF    0A.3
131
0047:  GOTO   022
132
.................... void pip()     // pipnuti a bliknuti  
133
.................... {  
134
....................    int1 beep;  
135
....................    int i;  
136
....................   
137
....................    for(i=0; i<250; i++)  
138
*
139
006A:  CLRF   2D
140
006B:  MOVF   2D,W
141
006C:  SUBLW  F9
142
006D:  BTFSS  03.0
143
006E:  GOTO   087
144
....................    {  
145
....................       output_bit(PIEZO, beep);  
146
006F:  BTFSC  2C.0
147
0070:  GOTO   073
148
0071:  BCF    05.6
149
0072:  GOTO   074
150
0073:  BSF    05.6
151
0074:  BSF    03.5
152
0075:  BCF    05.6
153
....................       beep=~beep;  
154
0076:  MOVLW  01
155
0077:  BCF    03.5
156
0078:  XORWF  2C,F
157
....................       output_bit(LED, beep);  
158
0079:  BTFSC  2C.0
159
007A:  GOTO   07D
160
007B:  BCF    05.7
161
007C:  GOTO   07E
162
007D:  BSF    05.7
163
007E:  BSF    03.5
164
007F:  BCF    05.7
165
....................       delay_us(100);  
166
0080:  MOVLW  21
167
0081:  MOVWF  77
168
0082:  DECFSZ 77,F
169
0083:  GOTO   082
170
....................    };  
171
0084:  BCF    03.5
172
0085:  INCF   2D,F
173
0086:  GOTO   06B
174
....................    output_high(PIEZO);  
175
0087:  BSF    03.5
176
0088:  BCF    05.6
177
0089:  BCF    03.5
178
008A:  BSF    05.6
179
....................    output_high(LED);  
180
008B:  BSF    03.5
181
008C:  BCF    05.7
182
008D:  BCF    03.5
183
008E:  BSF    05.7
184
.................... }  
185
008F:  RETLW  00
186
....................   
187
.................... void cvak()    // pouze cvaknuti piezoelementem bez bliknuti  
188
.................... {  
189
....................    output_bit(PIEZO,~input(PIEZO));  
190
*
191
005D:  BSF    03.5
192
005E:  BSF    05.6
193
005F:  BCF    03.5
194
0060:  BTFSS  05.6
195
0061:  GOTO   064
196
0062:  BCF    05.6
197
0063:  GOTO   065
198
0064:  BSF    05.6
199
0065:  BSF    03.5
200
0066:  BCF    05.6
201
.................... }  
202
0067:  BCF    03.5
203
0068:  BCF    0A.3
204
0069:  GOTO   106 (RETURN)
205
....................   
206
.................... void main()  
207
.................... {  
208
*
209
0090:  CLRF   04
210
0091:  MOVLW  1F
211
0092:  ANDWF  03,F
212
0093:  BSF    03.5
213
0094:  BCF    1F.4
214
0095:  BCF    1F.5
215
0096:  MOVF   1B,W
216
0097:  ANDLW  80
217
0098:  MOVWF  1B
218
0099:  MOVLW  07
219
009A:  MOVWF  1C
220
009B:  MOVF   1C,W
221
009C:  BCF    03.5
222
009D:  BCF    0D.6
223
009E:  MOVLW  60
224
009F:  BSF    03.5
225
00A0:  MOVWF  0F
226
....................    int8 n;  
227
....................    int8 perioda;  
228
....................      
229
....................    setup_adc_ports(ADC_CLOCK_INTERNAL|sAN4|VSS_VDD);  
230
00A1:  BCF    1F.4
231
00A2:  BCF    1F.5
232
00A3:  MOVF   1B,W
233
00A4:  ANDLW  80
234
00A5:  IORLW  D0
235
00A6:  MOVWF  1B
236
....................    setup_adc(ADC_CLOCK_INTERNAL);  
237
00A7:  BCF    1F.6
238
00A8:  BCF    03.5
239
00A9:  BSF    1F.6
240
00AA:  BSF    1F.7
241
00AB:  BSF    03.5
242
00AC:  BCF    1F.7
243
00AD:  BCF    03.5
244
00AE:  BSF    1F.0
245
....................    setup_spi(FALSE);  
246
00AF:  BCF    14.5
247
00B0:  BSF    03.5
248
00B1:  BCF    06.2
249
00B2:  BSF    06.1
250
00B3:  BCF    06.4
251
00B4:  MOVLW  00
252
00B5:  BCF    03.5
253
00B6:  MOVWF  14
254
00B7:  BSF    03.5
255
00B8:  MOVWF  14
256
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);  
257
00B9:  MOVF   01,W
258
00BA:  ANDLW  C0
259
00BB:  IORLW  07
260
00BC:  MOVWF  01
261
....................    setup_timer_1(T1_DISABLED);  
262
00BD:  BCF    03.5
263
00BE:  CLRF   10
264
....................    setup_comparator(NC_NC_NC_NC);  
265
00BF:  MOVLW  07
266
00C0:  BSF    03.5
267
00C1:  MOVWF  1C
268
00C2:  MOVF   05,W
269
00C3:  MOVLW  03
270
00C4:  MOVWF  77
271
00C5:  DECFSZ 77,F
272
00C6:  GOTO   0C5
273
00C7:  MOVF   1C,W
274
00C8:  BCF    03.5
275
00C9:  BCF    0D.6
276
....................    setup_vref(FALSE);  
277
00CA:  BSF    03.5
278
00CB:  CLRF   1D
279
....................   
280
....................    output_low(MENIC);      // Vsechno zastav  
281
00CC:  BCF    06.3
282
00CD:  BCF    03.5
283
00CE:  BCF    06.3
284
....................    output_low(MOTOR);  
285
00CF:  BSF    03.5
286
00D0:  BCF    06.2
287
00D1:  BCF    03.5
288
00D2:  BCF    06.2
289
....................    output_low(REFPWR);  
290
00D3:  BSF    03.5
291
00D4:  BCF    06.1
292
00D5:  BCF    03.5
293
00D6:  BCF    06.1
294
....................    output_high(LED);  
295
00D7:  BSF    03.5
296
00D8:  BCF    05.7
297
00D9:  BCF    03.5
298
00DA:  BSF    05.7
299
....................    output_high(PIEZO);  
300
00DB:  BSF    03.5
301
00DC:  BCF    05.6
302
00DD:  BCF    03.5
303
00DE:  BSF    05.6
304
....................   
305
....................    set_adc_channel(4);     // Vyber AD kanal pro pomerne mereni napeti  
306
00DF:  MOVLW  20
307
00E0:  MOVWF  78
308
00E1:  MOVF   1F,W
309
00E2:  ANDLW  C7
310
00E3:  IORWF  78,W
311
00E4:  MOVWF  1F
312
....................    set_pwm1_duty(0);       // Spust PWM, ale zatim s trvalou 0 na vystupu  
313
00E5:  CLRF   15
314
....................    setup_ccp1(CCP_PWM);             // PWM pro zatizeni clanku v seru  
315
00E6:  BSF    03.5
316
00E7:  BCF    06.3
317
00E8:  BCF    03.5
318
00E9:  BCF    06.3
319
00EA:  MOVLW  0C
320
00EB:  MOVWF  17
321
....................    setup_timer_2(T2_DIV_BY_1,100,1); // perioda  
322
00EC:  MOVLW  00
323
00ED:  MOVWF  78
324
00EE:  IORLW  04
325
00EF:  MOVWF  12
326
00F0:  MOVLW  64
327
00F1:  BSF    03.5
328
00F2:  MOVWF  12
329
....................   
330
....................    setup_oscillator(OSC_4MHZ|OSC_INTRC); // rozjed PIC (zvysi se odber)  
331
00F3:  MOVLW  62
332
00F4:  MOVWF  0F
333
....................   
334
....................   
335
.................... // jsme v depu? 
336
....................    set_pwm1_duty(2);          // PWM pro zatizeni clanku pri malem osvetleni  
337
00F5:  MOVLW  02
338
00F6:  BCF    03.5
339
00F7:  MOVWF  15
340
....................    n=0;  
341
00F8:  CLRF   2A
342
....................    do  
343
....................    {  
344
....................       output_low(REFPWR);  
345
00F9:  BSF    03.5
346
00FA:  BCF    06.1
347
00FB:  BCF    03.5
348
00FC:  BCF    06.1
349
....................       delay_ms(100);  
350
00FD:  MOVLW  64
351
00FE:  MOVWF  2D
352
00FF:  CALL   048
353
....................       if (4==n++) {cvak(); n=0;};  
354
0100:  MOVF   2A,W
355
0101:  INCF   2A,F
356
0102:  SUBLW  04
357
0103:  BTFSS  03.2
358
0104:  GOTO   107
359
0105:  GOTO   05D
360
0106:  CLRF   2A
361
....................       output_high(REFPWR);          // zapni napajeni napetove reference  
362
0107:  BSF    03.5
363
0108:  BCF    06.1
364
0109:  BCF    03.5
365
010A:  BSF    06.1
366
....................       delay_ms(1);  
367
010B:  MOVLW  01
368
010C:  MOVWF  2D
369
010D:  CALL   048
370
....................    } while (read_adc()>REFSTART); // Odkryl starter clanky? 
371
010E:  BSF    1F.2
372
010F:  BTFSC  1F.2
373
0110:  GOTO   10F
374
0111:  MOVF   1E,W
375
0112:  SUBLW  50
376
0113:  BTFSS  03.0
377
0114:  GOTO   0F9
378
....................    output_low(REFPWR);  
379
0115:  BSF    03.5
380
0116:  BCF    06.1
381
0117:  BCF    03.5
382
0118:  BCF    06.1
383
....................   
384
....................    pip();                  // potvrzeni odstartovani  
385
0119:  CALL   06A
386
....................   
387
.................... // regulace  
388
....................    perioda=100;          // nastav optimalni periodu pri jedne 500W zarovce  
389
011A:  MOVLW  64
390
011B:  MOVWF  2B
391
....................    for(n=0;n<=7;n++)  
392
011C:  CLRF   2A
393
011D:  MOVF   2A,W
394
011E:  SUBLW  07
395
011F:  BTFSS  03.0
396
0120:  GOTO   143
397
....................    {  
398
....................       set_pwm1_duty(0);  
399
0121:  CLRF   15
400
....................       setup_timer_2(T2_DIV_BY_1,perioda,1);  // perioda  
401
0122:  MOVLW  00
402
0123:  MOVWF  78
403
0124:  IORLW  04
404
0125:  MOVWF  12
405
0126:  MOVF   2B,W
406
0127:  BSF    03.5
407
0128:  MOVWF  12
408
....................       set_pwm1_duty(19);                     // delka sepnuti  
409
0129:  MOVLW  13
410
012A:  BCF    03.5
411
012B:  MOVWF  15
412
....................       delay_ms(100);  
413
012C:  MOVLW  64
414
012D:  MOVWF  2D
415
012E:  CALL   048
416
....................       output_high(REFPWR);          // zapni napajeni napetove reference  
417
012F:  BSF    03.5
418
0130:  BCF    06.1
419
0131:  BCF    03.5
420
0132:  BSF    06.1
421
....................       delay_ms(1);  
422
0133:  MOVLW  01
423
0134:  MOVWF  2D
424
0135:  CALL   048
425
....................       if (read_adc()<REFNOM) perioda--;  // zvyseni zatizeni menice  
426
0136:  BSF    1F.2
427
0137:  BTFSC  1F.2
428
0138:  GOTO   137
429
0139:  MOVF   1E,W
430
013A:  SUBLW  6A
431
013B:  BTFSC  03.0
432
013C:  DECF   2B,F
433
....................       output_low(REFPWR);            // konec mereni, odpoj napajeni reference  
434
013D:  BSF    03.5
435
013E:  BCF    06.1
436
013F:  BCF    03.5
437
0140:  BCF    06.1
438
....................    };  
439
0141:  INCF   2A,F
440
0142:  GOTO   11D
441
....................   
442
.................... // nabíjíme  
443
....................    delay_ms(14000);  
444
0143:  MOVLW  38
445
0144:  MOVWF  2C
446
0145:  MOVLW  FA
447
0146:  MOVWF  2D
448
0147:  CALL   048
449
0148:  DECFSZ 2C,F
450
0149:  GOTO   145
451
....................   
452
.................... // rozjezd  
453
....................    SSPSTAT = 0;  
454
014A:  BSF    03.5
455
014B:  CLRF   14
456
....................    SSPCON1 = 0x22;               // SPI OSC/64  
457
014C:  MOVLW  22
458
014D:  BCF    03.5
459
014E:  MOVWF  14
460
....................    MotorPattern=0x02;            // prvni data pro vyslani  
461
014F:  MOVLW  02
462
0150:  MOVWF  29
463
....................    SSPBUF=MotorPattern;          // data pro vyslani  
464
0151:  MOVF   29,W
465
0152:  MOVWF  13
466
....................    enable_interrupts(global);  
467
0153:  MOVLW  C0
468
0154:  IORWF  0B,F
469
....................    enable_interrupts(INT_SSP);   // az budou vyslana, prijde interrupt od SSP  
470
0155:  BSF    03.5
471
0156:  BSF    0C.3
472
....................      
473
....................    for(n=0; n<=7; n++)     // razeni osmi rychlostnich stupnu  
474
0157:  BCF    03.5
475
0158:  CLRF   2A
476
0159:  MOVF   2A,W
477
015A:  SUBLW  07
478
015B:  BTFSS  03.0
479
015C:  GOTO   166
480
....................    {  
481
....................       MotorPattern=Pattern[n];  
482
015D:  MOVF   2A,W
483
015E:  CALL   037
484
015F:  MOVWF  78
485
0160:  MOVWF  29
486
....................       delay_ms(RAZENI);             // Pockej na dalsi razeni  
487
0161:  MOVLW  3C
488
0162:  MOVWF  2D
489
0163:  CALL   048
490
....................    };  
491
0164:  INCF   2A,F
492
0165:  GOTO   159
493
....................    SSPSTAT = 0;  
494
0166:  BSF    03.5
495
0167:  CLRF   14
496
....................    SSPCON1 = 0;                     // SPI stop  
497
0168:  BCF    03.5
498
0169:  CLRF   14
499
....................    disable_interrupts(INT_SSP);     // zastav preruseni od SSP  
500
016A:  BSF    03.5
501
016B:  BCF    0C.3
502
....................   
503
.................... // jedem co to da  
504
....................    output_high(MOTOR);  
505
016C:  BCF    06.2
506
016D:  BCF    03.5
507
016E:  BSF    06.2
508
....................    delay_ms(1000);  
509
016F:  MOVLW  04
510
0170:  MOVWF  2C
511
0171:  MOVLW  FA
512
0172:  MOVWF  2D
513
0173:  CALL   048
514
0174:  DECFSZ 2C,F
515
0175:  GOTO   171
516
....................    output_low(MOTOR);  
517
0176:  BSF    03.5
518
0177:  BCF    06.2
519
0178:  BCF    03.5
520
0179:  BCF    06.2
521
....................    set_pwm1_duty(0);                // zastav menic  
522
017A:  CLRF   15
523
....................   
524
.................... // vybiti kondenzatoru pro ucely mereni  
525
....................    pip();  
526
017B:  CALL   06A
527
....................    delay_ms(2000);  
528
017C:  MOVLW  08
529
017D:  MOVWF  2C
530
017E:  MOVLW  FA
531
017F:  MOVWF  2D
532
0180:  CALL   048
533
0181:  DECFSZ 2C,F
534
0182:  GOTO   17E
535
....................    pip();  
536
0183:  CALL   06A
537
....................    output_high(MOTOR);  
538
0184:  BSF    03.5
539
0185:  BCF    06.2
540
0186:  BCF    03.5
541
0187:  BSF    06.2
542
....................   
543
....................    while(true)  
544
....................    {  
545
....................       output_high(LED);  
546
0188:  BSF    03.5
547
0189:  BCF    05.7
548
018A:  BCF    03.5
549
018B:  BSF    05.7
550
....................       output_low(PIEZO);  
551
018C:  BSF    03.5
552
018D:  BCF    05.6
553
018E:  BCF    03.5
554
018F:  BCF    05.6
555
....................       delay_ms(300);  
556
0190:  MOVLW  02
557
0191:  MOVWF  2C
558
0192:  MOVLW  96
559
0193:  MOVWF  2D
560
0194:  CALL   048
561
0195:  DECFSZ 2C,F
562
0196:  GOTO   192
563
....................       output_low(LED);  
564
0197:  BSF    03.5
565
0198:  BCF    05.7
566
0199:  BCF    03.5
567
019A:  BCF    05.7
568
....................       output_high(PIEZO);  
569
019B:  BSF    03.5
570
019C:  BCF    05.6
571
019D:  BCF    03.5
572
019E:  BSF    05.6
573
....................       delay_ms(300);  
574
019F:  MOVLW  02
575
01A0:  MOVWF  2C
576
01A1:  MOVLW  96
577
01A2:  MOVWF  2D
578
01A3:  CALL   048
579
01A4:  DECFSZ 2C,F
580
01A5:  GOTO   1A1
581
....................    }  
582
01A6:  GOTO   188
583
.................... // priprava na dalsi jizdu  
584
....................    delay_ms(5000);  
585
01A7:  MOVLW  14
586
01A8:  MOVWF  2C
587
01A9:  MOVLW  FA
588
01AA:  MOVWF  2D
589
01AB:  CALL   048
590
01AC:  DECFSZ 2C,F
591
01AD:  GOTO   1A9
592
....................    reset_cpu();  
593
01AE:  CLRF   0A
594
01AF:  GOTO   000
595
.................... }  
596
....................  
597
01B0:  SLEEP
598
 
599
Configuration Fuses:
600
   Word  1: 2738   NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT DEBUG CCPB3 NOPROTECT INTRC_IO
601
   Word  2: 3FFC   NOFCMEN NOIESO