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               18-IX-05 23:22
2
 
3
               Filename: C:\PIC\jumpk\menic.LST
4
 
5
               ROM used: 328 words (8%)
6
                         Largest free fragment is 2048
7
               RAM used: 21 (12%) at main() level
8
                         21 (12%) 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   05F
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
....................  //----------------------------  
68
.................... // Sagitta - 9. 9. 2005  
69
.................... //----------------------------  
70
....................   
71
.................... #include ".\menic.h" 
72
....................  #include <16F88.h> 
73
....................  //////// Standard Header file for the PIC16F88 device ////////////////  
74
.................... #device PIC16F88  
75
.................... #list  
76
....................  
77
....................   
78
.................... #device adc=8  
79
....................   
80
.................... #fuses   WDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, \  
81
....................          NODEBUG, NOPROTECT, NOFCMEN, NOIESO, CCPB3  
82
....................   
83
.................... #use delay(clock=4000000, RESTART_WDT)  
84
*
85
0048:  MOVLW  2F
86
0049:  MOVWF  04
87
004A:  MOVF   00,W
88
004B:  BTFSC  03.2
89
004C:  GOTO   05E
90
004D:  MOVLW  01
91
004E:  MOVWF  78
92
004F:  MOVLW  BF
93
0050:  MOVWF  77
94
0051:  CLRWDT
95
0052:  DECFSZ 77,F
96
0053:  GOTO   051
97
0054:  DECFSZ 78,F
98
0055:  GOTO   04F
99
0056:  MOVLW  4A
100
0057:  MOVWF  77
101
0058:  DECFSZ 77,F
102
0059:  GOTO   058
103
005A:  NOP
104
005B:  CLRWDT
105
005C:  DECFSZ 00,F
106
005D:  GOTO   04D
107
005E:  RETLW  00
108
....................   
109
....................  
110
....................   
111
.................... #define RAZENI    55    // Po kolika ms se bude menit rychlost pri rozjizdeni  
112
.................... #define REFSTART  120   // Hodnota komparatoru odpovidajici 1,7V pri  
113
....................                         // nezatizenych solarnich clancich  
114
.................... #define DUTY1     2     // Delka sepnuti PWM v us pro sero  
115
.................... #define DUTY2     20    // Delka sepnuti PWM v us pro jednu zarovku 500W  
116
....................   
117
.................... // Tabulka napeti vuci referencni LED (cca 1,7V)  
118
.................... // hodnota prevodniku / napeti na clancich  
119
.................... // 250   1,6V  
120
.................... // 200   2,1V  
121
.................... // 150   2,8V  
122
.................... // 145   2,9V  
123
.................... // 120   3,6V  
124
.................... // 110   4,0V  
125
....................   
126
.................... #define MENIC  PIN_B3   // Spinani tranzistoru menice  
127
.................... #define REFPWR PIN_B1   // Napajeni zdroje referencniho napeti  
128
.................... #define MOTOR  PIN_B2   // Spinani tranzistoru motoru  
129
....................   
130
.................... #byte SSPBUF   = 0x13   // Registry jednotky SSP  
131
.................... #byte SSPCON1  = 0x14  
132
.................... #byte SSPSTAT  = 0x94  
133
....................   
134
.................... // Vzorky pro generovani PWM pomoci SSP  
135
.................... unsigned int8 const Pattern[8] = {0x02,0x06,0x0e,0x1e,0x3e,0x7e,0xfe,0xff};  
136
.................... unsigned int8 MotorPattern;  
137
....................   
138
.................... #INT_SSP  
139
.................... void IntSSP()     // Vyvola se po odeslani znaku pres SSP  
140
.................... {  
141
....................    SSPBUF=MotorPattern;       // znovu vysli stejnou hodnotu  
142
*
143
0043:  MOVF   29,W
144
0044:  MOVWF  13
145
.................... }  
146
....................   
147
0045:  BCF    0C.3
148
0046:  BCF    0A.3
149
0047:  GOTO   022
150
.................... void main()  
151
.................... {  
152
*
153
005F:  CLRF   04
154
0060:  MOVLW  1F
155
0061:  ANDWF  03,F
156
0062:  BSF    03.5
157
0063:  BCF    1F.4
158
0064:  BCF    1F.5
159
0065:  MOVF   1B,W
160
0066:  ANDLW  80
161
0067:  MOVWF  1B
162
0068:  MOVLW  07
163
0069:  MOVWF  1C
164
006A:  MOVF   1C,W
165
006B:  BCF    03.5
166
006C:  BCF    0D.6
167
006D:  MOVLW  60
168
006E:  BSF    03.5
169
006F:  MOVWF  0F
170
....................    int8 n;  
171
....................    int8 cekej;  
172
....................    int8 perioda;  
173
....................    int8 rozjezd;  
174
....................   
175
....................    // Inicializace casovacu a prevodniku  
176
....................    setup_timer_0(RTCC_INTERNAL);setup_wdt(WDT_1152MS);  
177
0070:  MOVF   01,W
178
0071:  ANDLW  C0
179
0072:  MOVWF  01
180
0073:  MOVLW  0E
181
0074:  MOVWF  77
182
0075:  MOVLW  07
183
0076:  BCF    03.5
184
0077:  CLRF   01
185
0078:  MOVLW  81
186
0079:  MOVWF  04
187
007A:  MOVF   00,W
188
007B:  ANDLW  F0
189
007C:  IORLW  07
190
007D:  MOVWF  00
191
007E:  CLRWDT
192
007F:  MOVF   00,W
193
0080:  ANDLW  F7
194
0081:  BTFSC  77.3
195
0082:  ANDLW  F0
196
0083:  IORWF  77,W
197
0084:  MOVWF  00
198
....................    setup_adc_ports(ADC_CLOCK_INTERNAL|sAN1|sAN4|VSS_VDD);  
199
0085:  BSF    03.5
200
0086:  BCF    1F.4
201
0087:  BCF    1F.5
202
0088:  MOVF   1B,W
203
0089:  ANDLW  80
204
008A:  IORLW  D2
205
008B:  MOVWF  1B
206
....................    setup_adc(ADC_CLOCK_INTERNAL);  
207
008C:  BCF    1F.6
208
008D:  BCF    03.5
209
008E:  BSF    1F.6
210
008F:  BSF    1F.7
211
0090:  BSF    03.5
212
0091:  BCF    1F.7
213
0092:  BCF    03.5
214
0093:  BSF    1F.0
215
....................    setup_spi(FALSE);  
216
0094:  BCF    14.5
217
0095:  BSF    03.5
218
0096:  BCF    06.2
219
0097:  BSF    06.1
220
0098:  BCF    06.4
221
0099:  MOVLW  00
222
009A:  BCF    03.5
223
009B:  MOVWF  14
224
009C:  BSF    03.5
225
009D:  MOVWF  14
226
....................    setup_timer_1(T1_DISABLED);  
227
009E:  BCF    03.5
228
009F:  CLRF   10
229
....................    setup_comparator(NC_NC_NC_NC);  
230
00A0:  MOVLW  07
231
00A1:  BSF    03.5
232
00A2:  MOVWF  1C
233
00A3:  MOVF   05,W
234
00A4:  CLRWDT
235
00A5:  MOVLW  02
236
00A6:  MOVWF  77
237
00A7:  DECFSZ 77,F
238
00A8:  GOTO   0A7
239
00A9:  NOP
240
00AA:  NOP
241
00AB:  MOVF   1C,W
242
00AC:  BCF    03.5
243
00AD:  BCF    0D.6
244
....................    setup_vref(FALSE);  
245
00AE:  BSF    03.5
246
00AF:  CLRF   1D
247
....................   
248
....................    output_low(MENIC);      // Vsechno zastav  
249
00B0:  BCF    06.3
250
00B1:  BCF    03.5
251
00B2:  BCF    06.3
252
....................    output_low(MOTOR);  
253
00B3:  BSF    03.5
254
00B4:  BCF    06.2
255
00B5:  BCF    03.5
256
00B6:  BCF    06.2
257
....................    output_low(REFPWR);  
258
00B7:  BSF    03.5
259
00B8:  BCF    06.1
260
00B9:  BCF    03.5
261
00BA:  BCF    06.1
262
....................   
263
....................    set_adc_channel(4);     // Vyber AD kanal pro pomerne mereni napeti  
264
00BB:  MOVLW  20
265
00BC:  MOVWF  78
266
00BD:  MOVF   1F,W
267
00BE:  ANDLW  C7
268
00BF:  IORWF  78,W
269
00C0:  MOVWF  1F
270
....................    set_pwm1_duty(0);       // Spust PWM, ale zatim s trvalou 0 na vystupu  
271
00C1:  CLRF   15
272
....................    setup_ccp1(CCP_PWM);             // PWM pro zatizeni clanku v seru  
273
00C2:  BSF    03.5
274
00C3:  BCF    06.3
275
00C4:  BCF    03.5
276
00C5:  BCF    06.3
277
00C6:  MOVLW  0C
278
00C7:  MOVWF  17
279
....................    setup_timer_2(T2_DIV_BY_1,100,1); // perioda PWM  
280
00C8:  MOVLW  00
281
00C9:  MOVWF  78
282
00CA:  IORLW  04
283
00CB:  MOVWF  12
284
00CC:  MOVLW  64
285
00CD:  BSF    03.5
286
00CE:  MOVWF  12
287
....................   
288
....................    setup_oscillator(OSC_4MHZ|OSC_INTRC); // rozjed PIC (zvysi se odber)  
289
00CF:  MOVLW  62
290
00D0:  MOVWF  0F
291
....................   
292
.................... // jsme v depu? 
293
....................    set_pwm1_duty(DUTY1);                     // delka sepnuti  
294
00D1:  MOVLW  02
295
00D2:  BCF    03.5
296
00D3:  MOVWF  15
297
....................    do  
298
....................    {  
299
....................       output_low(REFPWR);  
300
00D4:  BSF    03.5
301
00D5:  BCF    06.1
302
00D6:  BCF    03.5
303
00D7:  BCF    06.1
304
....................       delay_ms(100);  
305
00D8:  MOVLW  64
306
00D9:  MOVWF  2F
307
00DA:  CALL   048
308
....................       output_high(REFPWR);          // zapni napajeni napetove reference (LED)  
309
00DB:  BSF    03.5
310
00DC:  BCF    06.1
311
00DD:  BCF    03.5
312
00DE:  BSF    06.1
313
....................       delay_ms(20);  
314
00DF:  MOVLW  14
315
00E0:  MOVWF  2F
316
00E1:  CALL   048
317
....................    } while (read_adc()>REFSTART);   // Odkryl starter clanky? 
318
00E2:  BSF    1F.2
319
00E3:  BTFSC  1F.2
320
00E4:  GOTO   0E3
321
00E5:  MOVF   1E,W
322
00E6:  SUBLW  78
323
00E7:  BTFSS  03.0
324
00E8:  GOTO   0D4
325
....................    output_low(REFPWR);  
326
00E9:  BSF    03.5
327
00EA:  BCF    06.1
328
00EB:  BCF    03.5
329
00EC:  BCF    06.1
330
....................   
331
....................    // Precti trimr  
332
....................    set_adc_channel(1);           // Zjisteni nastaveni trimru PWM  
333
00ED:  MOVLW  08
334
00EE:  MOVWF  78
335
00EF:  MOVF   1F,W
336
00F0:  ANDLW  C7
337
00F1:  IORWF  78,W
338
00F2:  MOVWF  1F
339
....................    delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku  
340
00F3:  CLRWDT
341
00F4:  MOVLW  20
342
00F5:  MOVWF  77
343
00F6:  DECFSZ 77,F
344
00F7:  GOTO   0F6
345
00F8:  NOP
346
00F9:  NOP
347
....................    perioda=(read_adc()>>1)+40;   // rozsah: 40 az 167  
348
00FA:  BSF    1F.2
349
00FB:  BTFSC  1F.2
350
00FC:  GOTO   0FB
351
00FD:  MOVF   1E,W
352
00FE:  MOVWF  77
353
00FF:  BCF    03.0
354
0100:  RRF    77,F
355
0101:  MOVF   77,W
356
0102:  ADDLW  28
357
0103:  MOVWF  2C
358
....................    set_pwm1_duty(0);       // Zastav PWM, aby slo zmenit periodu  
359
0104:  CLRF   15
360
....................    setup_timer_2(T2_DIV_BY_1,perioda,1); // Zapis nastavenou periodu  
361
0105:  MOVLW  00
362
0106:  MOVWF  78
363
0107:  IORLW  04
364
0108:  MOVWF  12
365
0109:  MOVF   2C,W
366
010A:  BSF    03.5
367
010B:  MOVWF  12
368
....................   
369
.................... // nabíjíme  
370
....................    set_pwm1_duty(DUTY2);            // delka sepnuti PWM  
371
010C:  MOVLW  14
372
010D:  BCF    03.5
373
010E:  MOVWF  15
374
....................    delay_ms(12500);  
375
010F:  MOVLW  32
376
0110:  MOVWF  2E
377
0111:  MOVLW  FA
378
0112:  MOVWF  2F
379
0113:  CALL   048
380
0114:  DECFSZ 2E,F
381
0115:  GOTO   111
382
....................   
383
.................... // rozjezd  
384
....................    SSPSTAT = 0;                  // inicializace SPI jednotky  
385
0116:  BSF    03.5
386
0117:  CLRF   14
387
....................    SSPCON1 = 0x22;               // SPI OSC/64  
388
0118:  MOVLW  22
389
0119:  BCF    03.5
390
011A:  MOVWF  14
391
....................    MotorPattern=Pattern[0];  
392
011B:  MOVLW  02
393
011C:  MOVWF  29
394
....................    SSPBUF=MotorPattern;          // 1. data pro vyslani  
395
011D:  MOVF   29,W
396
011E:  MOVWF  13
397
....................    enable_interrupts(global);  
398
011F:  MOVLW  C0
399
0120:  IORWF  0B,F
400
....................    enable_interrupts(INT_SSP);   // az budou vyslana, prijde preruseni  
401
0121:  BSF    03.5
402
0122:  BSF    0C.3
403
....................   
404
....................    for(n=0; n<=7; n++)     // razeni osmi rychlostnich stupnu  
405
0123:  BCF    03.5
406
0124:  CLRF   2A
407
0125:  MOVF   2A,W
408
0126:  SUBLW  07
409
0127:  BTFSS  03.0
410
0128:  GOTO   132
411
....................    {  
412
....................       MotorPattern=Pattern[n];  
413
0129:  MOVF   2A,W
414
012A:  CALL   037
415
012B:  MOVWF  78
416
012C:  MOVWF  29
417
....................       delay_ms(RAZENI);             // Pockej na dalsi razeni  
418
012D:  MOVLW  37
419
012E:  MOVWF  2F
420
012F:  CALL   048
421
....................    };  
422
0130:  INCF   2A,F
423
0131:  GOTO   125
424
....................    SSPSTAT = 0;  
425
0132:  BSF    03.5
426
0133:  CLRF   14
427
....................    SSPCON1 = 0;                     // SPI stop  
428
0134:  BCF    03.5
429
0135:  CLRF   14
430
....................    disable_interrupts(INT_SSP);     // zastav preruseni od SSP  
431
0136:  BSF    03.5
432
0137:  BCF    0C.3
433
....................   
434
.................... // jedem co to da  
435
....................    output_high(MOTOR);  
436
0138:  BCF    06.2
437
0139:  BCF    03.5
438
013A:  BSF    06.2
439
....................    delay_ms(1300);         // dyl jak 1,3s bysme nemeli jet :)  
440
013B:  MOVLW  0A
441
013C:  MOVWF  2E
442
013D:  MOVLW  82
443
013E:  MOVWF  2F
444
013F:  CALL   048
445
0140:  DECFSZ 2E,F
446
0141:  GOTO   13D
447
....................    output_low(MOTOR);      // zastav motor  
448
0142:  BSF    03.5
449
0143:  BCF    06.2
450
0144:  BCF    03.5
451
0145:  BCF    06.2
452
....................                            // Menic je stale zapnut a zatezuje clanky  
453
....................   
454
....................    while(TRUE);            // Cekej, dokud se neztrati svetlo,  
455
0146:  GOTO   146
456
....................                            // nebo prijde WatchDog  
457
.................... }  
458
....................  
459
0147:  SLEEP
460
 
461
Configuration Fuses:
462
   Word  1: 2F3C   WDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB3 NOPROTECT INTRC_IO
463
   Word  2: 3FFC   NOFCMEN NOIESO