Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
CCS PCM C Compiler, Version 3.234, 27853               16-X-05 21:12
2
 
3
               Filename: C:\MIHO_DAT\KROKAC\krokac.LST
4
 
5
               ROM used: 321 words (8%)
6
                         Largest free fragment is 2048
7
               RAM used: 21 (12%) at main() level
8
                         24 (14%) worst case
9
               Stack:    3 worst case (1 in main + 2 for interrupts)
10
 
11
*
12
0000:  MOVLW  00
13
0001:  MOVWF  0A
14
0002:  GOTO   098
15
0003:  NOP
16
0004:  MOVWF  7F
17
0005:  SWAPF  03,W
18
0006:  CLRF   03
19
0007:  MOVWF  21
20
0008:  MOVF   7F,W
21
0009:  MOVWF  20
22
000A:  MOVF   0A,W
23
000B:  MOVWF  28
24
000C:  CLRF   0A
25
000D:  SWAPF  20,F
26
000E:  MOVF   04,W
27
000F:  MOVWF  22
28
0010:  MOVF   77,W
29
0011:  MOVWF  23
30
0012:  MOVF   78,W
31
0013:  MOVWF  24
32
0014:  MOVF   79,W
33
0015:  MOVWF  25
34
0016:  MOVF   7A,W
35
0017:  MOVWF  26
36
0018:  MOVF   7B,W
37
0019:  MOVWF  27
38
001A:  BCF    03.7
39
001B:  BCF    03.5
40
001C:  MOVLW  8C
41
001D:  MOVWF  04
42
001E:  BTFSS  00.1
43
001F:  GOTO   022
44
0020:  BTFSC  0C.1
45
0021:  GOTO   035
46
0022:  MOVF   22,W
47
0023:  MOVWF  04
48
0024:  MOVF   23,W
49
0025:  MOVWF  77
50
0026:  MOVF   24,W
51
0027:  MOVWF  78
52
0028:  MOVF   25,W
53
0029:  MOVWF  79
54
002A:  MOVF   26,W
55
002B:  MOVWF  7A
56
002C:  MOVF   27,W
57
002D:  MOVWF  7B
58
002E:  MOVF   28,W
59
002F:  MOVWF  0A
60
0030:  SWAPF  21,W
61
0031:  MOVWF  03
62
0032:  SWAPF  7F,F
63
0033:  SWAPF  7F,W
64
0034:  RETFIE
65
0035:  BCF    0A.3
66
0036:  GOTO   043
67
....................  #include "C:\MIHO_DAT\KROKAC\krokac.h" 
68
....................  #include <16F88.h> 
69
....................  //////// Standard Header file for the PIC16F88 device ////////////////  
70
.................... #device PIC16F88  
71
.................... #list  
72
....................  
73
.................... //#device ICD=TRUE  
74
.................... #device adc=8  
75
....................   
76
.................... #FUSES NOWDT                 	//No Watch Dog Timer  
77
.................... #FUSES RC                     //Resistor/Capacitor Osc with CLKOUT  
78
.................... #FUSES NOPUT                 	//No Power Up Timer  
79
.................... #FUSES MCLR                  	//Master Clear pin enabled  
80
.................... #FUSES NOBROWNOUT            	//No brownout reset  
81
.................... #FUSES NOLVP                 	//No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O  
82
.................... #FUSES NOCPD                 	//No EE protection  
83
.................... #FUSES NOWRT                 	//Program memory not write protected  
84
.................... //#FUSES DEBUG                 	//Debug mode for use with ICD  
85
.................... #FUSES NOPROTECT             	//Code not protected from reading  
86
.................... #FUSES FCMEN                 	//Fail-safe clock monitor enabled  
87
.................... #FUSES IESO                  	//Internal External Switch Over mode enabled  
88
....................   
89
.................... #use delay(clock=4000000)  
90
*
91
0082:  MOVLW  31
92
0083:  MOVWF  04
93
0084:  MOVF   00,W
94
0085:  BTFSC  03.2
95
0086:  GOTO   096
96
0087:  MOVLW  01
97
0088:  MOVWF  78
98
0089:  CLRF   77
99
008A:  DECFSZ 77,F
100
008B:  GOTO   08A
101
008C:  DECFSZ 78,F
102
008D:  GOTO   089
103
008E:  MOVLW  4A
104
008F:  MOVWF  77
105
0090:  DECFSZ 77,F
106
0091:  GOTO   090
107
0092:  NOP
108
0093:  NOP
109
0094:  DECFSZ 00,F
110
0095:  GOTO   087
111
0096:  BCF    0A.3
112
0097:  GOTO   130 (RETURN)
113
.................... #define MOTORA   PIN_B0  
114
.................... #define MOTORB   PIN_B1  
115
.................... #define MOTORC   PIN_B2  
116
.................... #define MOTORD   PIN_B3  
117
....................   
118
....................  
119
....................   
120
....................   
121
.................... unsigned int   StepState;     // Vnitrni promenna kroku  
122
.................... signed int     StepDirection; // Smer +1/0/-1  
123
....................   
124
.................... byte const StepTab[8]={       // Tabulka pro krokovy motor  
125
....................          0b0001,     // 0           
126
....................          0b0101,     // 1  
127
....................          0b0100,     // 2  
128
....................          0b0110,     // 3  
129
....................          0b0010,     // 4  
130
....................          0b1010,     // 5  
131
....................          0b1000      // 6  
132
....................          0b1001,     // 7  
133
....................          };  
134
....................            
135
.................... #INT_TIMER2  
136
.................... void StepNext()  
137
.................... {  
138
....................    unsigned int i;  
139
....................      
140
....................    StepState+=StepDirection;     // posun se na dalsi krok  
141
*
142
0043:  MOVF   2A,W
143
0044:  ADDWF  29,W
144
0045:  MOVWF  29
145
....................    i=StepState&0b111;            // vezmi spodni 3 bity stavu  
146
0046:  MOVF   29,W
147
0047:  ANDLW  07
148
0048:  MOVWF  32
149
....................    i=StepTab[i];                 // prekoduj pomoci tabulky  
150
0049:  MOVF   32,W
151
004A:  CALL   037
152
004B:  MOVWF  78
153
004C:  MOVWF  32
154
....................    output_bit(MOTORA,i&0b0001);  // aktivuj jednotlive vystupy  
155
004D:  BTFSC  32.0
156
004E:  GOTO   051
157
004F:  BCF    06.0
158
0050:  GOTO   052
159
0051:  BSF    06.0
160
0052:  BSF    03.5
161
0053:  BCF    06.0
162
....................    output_bit(MOTORB,i&0b0010);  
163
0054:  BCF    03.5
164
0055:  BTFSC  32.1
165
0056:  GOTO   059
166
0057:  BCF    06.1
167
0058:  GOTO   05A
168
0059:  BSF    06.1
169
005A:  BSF    03.5
170
005B:  BCF    06.1
171
....................    output_bit(MOTORC,i&0b0100);  
172
005C:  BCF    03.5
173
005D:  BTFSC  32.2
174
005E:  GOTO   061
175
005F:  BCF    06.2
176
0060:  GOTO   062
177
0061:  BSF    06.2
178
0062:  BSF    03.5
179
0063:  BCF    06.2
180
....................    output_bit(MOTORD,i&0b1000);  
181
0064:  BCF    03.5
182
0065:  BTFSC  32.3
183
0066:  GOTO   069
184
0067:  BCF    06.3
185
0068:  GOTO   06A
186
0069:  BSF    06.3
187
006A:  BSF    03.5
188
006B:  BCF    06.3
189
.................... }  
190
....................   
191
....................   
192
006C:  BCF    03.5
193
006D:  BCF    0C.1
194
006E:  BCF    0A.3
195
006F:  GOTO   022
196
.................... void StepSetDirection(signed int Direction)  
197
.................... {  
198
....................    if(Direction> 1) Direction= 1;  
199
0070:  BTFSC  30.7
200
0071:  GOTO   078
201
0072:  MOVF   30,W
202
0073:  SUBLW  01
203
0074:  BTFSC  03.0
204
0075:  GOTO   078
205
0076:  MOVLW  01
206
0077:  MOVWF  30
207
....................    if(Direction<-1) Direction=-1;  
208
0078:  MOVF   30,W
209
0079:  XORLW  80
210
007A:  SUBLW  7E
211
007B:  BTFSS  03.0
212
007C:  GOTO   07F
213
007D:  MOVLW  FF
214
007E:  MOVWF  30
215
....................    StepDirection=Direction;  
216
007F:  MOVF   30,W
217
0080:  MOVWF  2A
218
.................... }  
219
0081:  RETLW  00
220
....................   
221
....................   
222
.................... void StepSetTime(unsigned int16 Time)  
223
.................... {  
224
....................      
225
.................... }  
226
....................   
227
.................... void Delay(unsigned int16 Time)  
228
.................... {  
229
....................    while(Time>255) {Time-=256;delay_us(256);};  
230
....................    if(Time!=0) delay_us(Time);  
231
.................... }  
232
....................   
233
....................   
234
.................... void main()  
235
.................... {  
236
*
237
0098:  CLRF   04
238
0099:  MOVLW  1F
239
009A:  ANDWF  03,F
240
009B:  BSF    03.5
241
009C:  BCF    1F.4
242
009D:  BCF    1F.5
243
009E:  MOVF   1B,W
244
009F:  ANDLW  80
245
00A0:  MOVWF  1B
246
00A1:  MOVLW  07
247
00A2:  MOVWF  1C
248
00A3:  MOVF   1C,W
249
00A4:  BCF    03.5
250
00A5:  BCF    0D.6
251
.................... unsigned int16 T;  
252
.................... unsigned long int i;  
253
....................   
254
....................    // Nastav pracovni frekvenci procesoru  
255
....................    setup_oscillator(OSC_4MHZ);  
256
00A6:  MOVLW  60
257
00A7:  BSF    03.5
258
00A8:  MOVWF  0F
259
....................   
260
....................    // Vypni motorovy vystup  
261
....................    output_low(MOTORA);  
262
00A9:  BCF    06.0
263
00AA:  BCF    03.5
264
00AB:  BCF    06.0
265
....................    output_low(MOTORB);  
266
00AC:  BSF    03.5
267
00AD:  BCF    06.1
268
00AE:  BCF    03.5
269
00AF:  BCF    06.1
270
....................    output_low(MOTORC);  
271
00B0:  BSF    03.5
272
00B1:  BCF    06.2
273
00B2:  BCF    03.5
274
00B3:  BCF    06.2
275
....................    output_low(MOTORD);  
276
00B4:  BSF    03.5
277
00B5:  BCF    06.3
278
00B6:  BCF    03.5
279
00B7:  BCF    06.3
280
....................   
281
....................    // Vstupy s pull-up odporem  
282
....................    port_b_pullups(TRUE);  
283
00B8:  BSF    03.5
284
00B9:  BCF    01.7
285
....................   
286
....................    // Inicializace A/D prevodniku  
287
....................    setup_adc_ports(sAN0|VSS_VDD);  
288
00BA:  BCF    1F.4
289
00BB:  BCF    1F.5
290
00BC:  MOVF   1B,W
291
00BD:  ANDLW  80
292
00BE:  IORLW  01
293
00BF:  MOVWF  1B
294
....................    setup_adc(ADC_CLOCK_INTERNAL);  
295
00C0:  BCF    1F.6
296
00C1:  BCF    03.5
297
00C2:  BSF    1F.6
298
00C3:  BSF    1F.7
299
00C4:  BSF    03.5
300
00C5:  BCF    1F.7
301
00C6:  BCF    03.5
302
00C7:  BSF    1F.0
303
....................    set_adc_channel(0);  
304
00C8:  MOVLW  00
305
00C9:  MOVWF  78
306
00CA:  MOVF   1F,W
307
00CB:  ANDLW  C7
308
00CC:  IORWF  78,W
309
00CD:  MOVWF  1F
310
....................   
311
....................    // Dalsi inicializace  
312
....................    setup_spi(FALSE);  
313
00CE:  BCF    14.5
314
00CF:  BSF    03.5
315
00D0:  BCF    06.2
316
00D1:  BSF    06.1
317
00D2:  BCF    06.4
318
00D3:  MOVLW  00
319
00D4:  BCF    03.5
320
00D5:  MOVWF  14
321
00D6:  BSF    03.5
322
00D7:  MOVWF  14
323
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);  
324
00D8:  MOVF   01,W
325
00D9:  ANDLW  C7
326
00DA:  IORLW  08
327
00DB:  MOVWF  01
328
....................    setup_timer_1(T1_DISABLED);  
329
00DC:  BCF    03.5
330
00DD:  CLRF   10
331
....................    setup_comparator(NC_NC_NC_NC);  
332
00DE:  MOVLW  07
333
00DF:  BSF    03.5
334
00E0:  MOVWF  1C
335
00E1:  MOVF   05,W
336
00E2:  MOVLW  03
337
00E3:  MOVWF  77
338
00E4:  DECFSZ 77,F
339
00E5:  GOTO   0E4
340
00E6:  MOVF   1C,W
341
00E7:  BCF    03.5
342
00E8:  BCF    0D.6
343
....................    setup_vref(FALSE);  
344
00E9:  BSF    03.5
345
00EA:  CLRF   1D
346
....................   
347
....................    // Inicializace stavovych promennych  
348
....................    StepState=0;  
349
00EB:  BCF    03.5
350
00EC:  CLRF   29
351
....................   
352
....................    // Nastaveni casovace  
353
....................    setup_timer_2(T2_DIV_BY_16,0xFF,1);  
354
00ED:  MOVLW  00
355
00EE:  MOVWF  78
356
00EF:  IORLW  06
357
00F0:  MOVWF  12
358
00F1:  MOVLW  FF
359
00F2:  BSF    03.5
360
00F3:  MOVWF  12
361
....................   
362
....................    // Nastveni preruseni od casovace  
363
....................    enable_interrupts(global);  
364
00F4:  MOVLW  C0
365
00F5:  BCF    03.5
366
00F6:  IORWF  0B,F
367
....................    enable_interrupts(int_timer2);  
368
00F7:  BSF    03.5
369
00F8:  BSF    0C.1
370
....................      
371
.................... for(;;)  
372
.................... {  
373
....................   
374
....................    T=read_adc(ADC_READ_ONLY);    // Prectu hodnotu  
375
00F9:  BCF    03.5
376
00FA:  BTFSS  1F.2
377
00FB:  GOTO   0FE
378
00FC:  BSF    03.5
379
00FD:  GOTO   0F9
380
00FE:  MOVF   1E,W
381
00FF:  CLRF   2C
382
0100:  MOVWF  2B
383
....................    read_adc(ADC_START_ONLY);     // Ostartuji dalsi prevod (na pozadi)  
384
0101:  BSF    1F.2
385
....................   
386
....................    //setup_timer_2(T2_DIV_BY_16,T,1);  
387
....................    if(T>0) *0x92=T;              // Preload register casovace  
388
0102:  MOVF   2B,F
389
0103:  BTFSS  03.2
390
0104:  GOTO   108
391
0105:  MOVF   2C,F
392
0106:  BTFSC  03.2
393
0107:  GOTO   10C
394
0108:  MOVF   2B,W
395
0109:  BSF    03.5
396
010A:  MOVWF  12
397
010B:  BCF    03.5
398
....................   
399
....................    // Podle prepinacu se hybu  
400
....................    if(input(PIN_B5))  
401
010C:  BSF    03.5
402
010D:  BSF    06.5
403
010E:  BCF    03.5
404
010F:  BTFSS  06.5
405
0110:  GOTO   11E
406
....................       {  
407
....................          if(input(PIN_B4)) StepSetDirection(1); else StepSetDirection(-1);  
408
0111:  BSF    03.5
409
0112:  BSF    06.4
410
0113:  BCF    03.5
411
0114:  BTFSS  06.4
412
0115:  GOTO   11A
413
0116:  MOVLW  01
414
0117:  MOVWF  30
415
0118:  CALL   070
416
0119:  GOTO   11D
417
011A:  MOVLW  FF
418
011B:  MOVWF  30
419
011C:  CALL   070
420
....................       }  
421
....................    else  
422
011D:  GOTO   13E
423
....................       {  int1 x;   // pomocna promenna aby se volalo spozdeni jen 1x  
424
....................          if (StepState>230) {  
425
011E:  MOVF   29,W
426
011F:  SUBLW  E6
427
0120:  BTFSC  03.0
428
0121:  GOTO   136
429
....................                               if (!input(PIN_B4) && (x))  
430
0122:  BSF    03.5
431
0123:  BSF    06.4
432
0124:  BCF    03.5
433
0125:  BTFSC  06.4
434
0126:  GOTO   133
435
0127:  BTFSS  2F.0
436
0128:  GOTO   133
437
....................                               {  
438
....................                                  StepSetDirection(0);  
439
0129:  CLRF   30
440
012A:  CALL   070
441
....................                                  delay_ms(500);  
442
012B:  MOVLW  02
443
012C:  MOVWF  30
444
012D:  MOVLW  FA
445
012E:  MOVWF  31
446
012F:  GOTO   082
447
0130:  DECFSZ 30,F
448
0131:  GOTO   12D
449
....................                                  x=0;  
450
0132:  BCF    2F.0
451
....................                               };  
452
....................                               StepSetDirection(-1);  
453
0133:  MOVLW  FF
454
0134:  MOVWF  30
455
0135:  CALL   070
456
....................                             }  
457
....................          if (StepState<30)  {  
458
0136:  MOVF   29,W
459
0137:  SUBLW  1D
460
0138:  BTFSS  03.0
461
0139:  GOTO   13E
462
....................                               StepSetDirection( 1);  
463
013A:  MOVLW  01
464
013B:  MOVWF  30
465
013C:  CALL   070
466
....................                               x=1;  
467
013D:  BSF    2F.0
468
....................                             }    
469
....................       }  
470
.................... //StepDirection=2;  
471
.................... //for(i=0;i<800;i++)  
472
.................... //{  
473
.................... //   StepNext();  
474
.................... //   Delay(T);  
475
.................... //}  
476
.................... //delay_ms(10);  
477
.................... //StepDirection=-1;  
478
.................... //for(i=0;i<800;i++)  
479
.................... //{  
480
.................... //   StepNext();  
481
.................... //   Delay(T);  
482
.................... //}  
483
.................... //delay_ms(10);  
484
....................   
485
.................... }  // Cyklus for  
486
013E:  BSF    03.5
487
013F:  GOTO   0F9
488
....................     
489
.................... }  
490
....................  
491
0140:  SLEEP
492
 
493
Configuration Fuses:
494
   Word  1: 3F3B   NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT RC
495
   Word  2: 3FFF   FCMEN IESO