Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
CCS PCW C Compiler, Version 3.110, 15448
2
 
3
               Filename: d:\@kaklik\programy\pic_c\prenos\letadlo\prijimac\ostra_bez_ladicich_impulsu\main.LST
4
 
5
               ROM used: 309 (30%)
6
                         Largest free fragment is 715
7
               RAM used: 18 (26%) at main() level
8
                         20 (29%) 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   083
15
0003:  NOP
16
0004:  BTFSC  03.5
17
0005:  GOTO   00A
18
0006:  MOVWF  0E
19
0007:  SWAPF  03,W
20
0008:  MOVWF  0F
21
0009:  GOTO   00F
22
000A:  BCF    03.5
23
000B:  MOVWF  0E
24
000C:  SWAPF  03,W
25
000D:  MOVWF  0F
26
000E:  BSF    0F.1
27
000F:  MOVF   0A,W
28
0010:  MOVWF  13
29
0011:  CLRF   0A
30
0012:  BCF    03.7
31
0013:  SWAPF  0E,F
32
0014:  MOVF   04,W
33
0015:  MOVWF  10
34
0016:  MOVF   0C,W
35
0017:  MOVWF  11
36
0018:  MOVF   0D,W
37
0019:  MOVWF  12
38
001A:  BCF    03.5
39
001B:  BTFSS  0B.5
40
001C:  GOTO   01F
41
001D:  BTFSC  0B.2
42
001E:  GOTO   043
43
001F:  MOVF   10,W
44
0020:  MOVWF  04
45
0021:  MOVF   11,W
46
0022:  MOVWF  0C
47
0023:  MOVF   12,W
48
0024:  MOVWF  0D
49
0025:  MOVF   13,W
50
0026:  MOVWF  0A
51
0027:  SWAPF  0F,W
52
0028:  MOVWF  03
53
0029:  BCF    03.5
54
002A:  SWAPF  0E,W
55
002B:  BTFSC  0F.1
56
002C:  BSF    03.5
57
002D:  RETFIE
58
....................  // Prijimac  
59
.................... #include "main.h" 
60
....................  #include <16F84.h> 
61
....................  //////// Standard Header file for the PIC16F84 device ////////////////  
62
.................... #device PIC16F84  
63
.................... #list  
64
....................  
65
.................... #use delay(clock=4000000)  
66
002E:  MOVLW  1F
67
002F:  MOVWF  04
68
0030:  MOVF   00,W
69
0031:  BTFSC  03.2
70
0032:  GOTO   042
71
0033:  MOVLW  01
72
0034:  MOVWF  0D
73
0035:  CLRF   0C
74
0036:  DECFSZ 0C,F
75
0037:  GOTO   036
76
0038:  DECFSZ 0D,F
77
0039:  GOTO   035
78
003A:  MOVLW  4A
79
003B:  MOVWF  0C
80
003C:  DECFSZ 0C,F
81
003D:  GOTO   03C
82
003E:  NOP
83
003F:  NOP
84
0040:  DECFSZ 00,F
85
0041:  GOTO   033
86
0042:  RETLW  00
87
.................... #fuses XT,PUT,NOWDT  
88
....................   
89
....................  
90
.................... #include "..\..\common.h" 
91
....................  #DEFINE  OSA_X          1           // adresy os  
92
.................... #DEFINE  OSA_Y          2  
93
.................... #DEFINE  OSA_Z          3  
94
.................... #DEFINE  OSA_W          4  
95
.................... #DEFINE  TLs            5  
96
.................... #DEFINE  Trim           6           // ovladani prijimace  
97
....................   
98
.................... #DEFINE  IMPULS         250         // sirka impulsu  
99
.................... #DEFINE  SYNC           15          // delka uvodniho ticha v IMPULS/4  
100
....................  
101
....................   
102
.................... #DEFINE  PRIJIMAC       PIN_A3      // pin na ktery je pripojen prijimac  
103
.................... #DEFINE  SERVO_X        PIN_A2      // piny na ktere jsou pripojena serva  
104
.................... #DEFINE  SERVO_Y        PIN_B0  
105
.................... #DEFINE  DILEK          20           // jeden krok serva v mikrosekundach  
106
....................   
107
.................... #bit  T0IF = 0xB.2   // int. flag od Timer0  
108
....................   
109
.................... static int8   x = 16;     // poloha serv  
110
.................... static int8   y = 16;  
111
.................... int8  trim_x = 2;  
112
.................... int8  trim_y = 2;  
113
....................   
114
.................... boolean flag;      // priznak, ze doslo k preruseni prijmu ovladanim serv  
115
....................   
116
.................... #int_TIMER0  
117
.................... TIMER0_isr()  
118
.................... {  
119
....................    int8 n;  
120
....................   
121
....................    flag = true;   // doslo k preruseni prijmu  
122
0043:  BSF    18.0
123
.................... //   x = 15;  
124
.................... //   y = 15;  
125
....................   
126
....................    output_high(SERVO_X);   // uvodni impuls 1ms  
127
0044:  BSF    03.5
128
0045:  BCF    05.2
129
0046:  BCF    03.5
130
0047:  BSF    05.2
131
....................    delay_ms(1);  
132
0048:  MOVLW  01
133
0049:  MOVWF  1F
134
004A:  CALL   02E
135
....................    for (n=trim_x; n>0; n--);  
136
004B:  MOVF   16,W
137
004C:  MOVWF  1E
138
004D:  MOVF   1E,F
139
004E:  BTFSC  03.2
140
004F:  GOTO   052
141
0050:  DECF   1E,F
142
0051:  GOTO   04D
143
....................    for (n=x; n>0; n--) Delay_us(DILEK);  
144
0052:  MOVF   14,W
145
0053:  MOVWF  1E
146
0054:  MOVF   1E,F
147
0055:  BTFSC  03.2
148
0056:  GOTO   05E
149
0057:  MOVLW  06
150
0058:  MOVWF  0C
151
0059:  DECFSZ 0C,F
152
005A:  GOTO   059
153
005B:  NOP
154
005C:  DECF   1E,F
155
005D:  GOTO   054
156
....................    output_low(SERVO_X);  
157
005E:  BSF    03.5
158
005F:  BCF    05.2
159
0060:  BCF    03.5
160
0061:  BCF    05.2
161
....................   
162
....................    output_high(SERVO_Y);  
163
0062:  BSF    03.5
164
0063:  BCF    06.0
165
0064:  BCF    03.5
166
0065:  BSF    06.0
167
....................    delay_ms(1);  
168
0066:  MOVLW  01
169
0067:  MOVWF  1F
170
0068:  CALL   02E
171
....................    for (n=trim_y; n>0; n--);  
172
0069:  MOVF   17,W
173
006A:  MOVWF  1E
174
006B:  MOVF   1E,F
175
006C:  BTFSC  03.2
176
006D:  GOTO   070
177
006E:  DECF   1E,F
178
006F:  GOTO   06B
179
....................    for (n=y; n>0; n--) Delay_us(DILEK);  
180
0070:  MOVF   15,W
181
0071:  MOVWF  1E
182
0072:  MOVF   1E,F
183
0073:  BTFSC  03.2
184
0074:  GOTO   07C
185
0075:  MOVLW  06
186
0076:  MOVWF  0C
187
0077:  DECFSZ 0C,F
188
0078:  GOTO   077
189
0079:  NOP
190
007A:  DECF   1E,F
191
007B:  GOTO   072
192
....................    output_low(SERVO_Y);  
193
007C:  BSF    03.5
194
007D:  BCF    06.0
195
007E:  BCF    03.5
196
007F:  BCF    06.0
197
0080:  BCF    0B.2
198
0081:  BCF    0A.3
199
0082:  GOTO   01F
200
.................... }  
201
....................   
202
.................... // output_high(PIN_B1);   // debug pin  
203
....................   
204
.................... void main()  
205
.................... {  
206
....................    int i;  
207
....................    int8 osa, data, check, suma;  
208
0083:  CLRF   04
209
0084:  MOVLW  1F
210
0085:  ANDWF  03,F
211
0086:  MOVLW  10
212
0087:  MOVWF  14
213
0088:  MOVWF  15
214
0089:  MOVLW  02
215
008A:  MOVWF  16
216
008B:  MOVWF  17
217
....................   
218
....................    setup_counters(RTCC_INTERNAL,RTCC_DIV_64);   // Preruseni po 16,3ms  
219
008C:  MOVLW  05
220
008D:  MOVWF  0C
221
008E:  BTFSS  0C.3
222
008F:  GOTO   098
223
0090:  MOVLW  07
224
0091:  CLRF   01
225
0092:  MOVLW  81
226
0093:  MOVWF  04
227
0094:  MOVF   00,W
228
0095:  ANDLW  C0
229
0096:  IORLW  0F
230
0097:  MOVWF  00
231
0098:  CLRWDT
232
0099:  MOVLW  81
233
009A:  MOVWF  04
234
009B:  MOVF   00,W
235
009C:  ANDLW  C0
236
009D:  IORWF  0C,W
237
009E:  MOVWF  00
238
....................    enable_interrupts(INT_TIMER0);  
239
009F:  BSF    0B.5
240
....................    enable_interrupts(global);  
241
00A0:  BSF    0B.7
242
....................   
243
.................... loop:  
244
....................    flag = false;  
245
00A1:  BCF    18.0
246
....................   
247
....................    // Cekej na uvodni ticho  
248
....................    for (i=SYNC; i>0; i--)  
249
00A2:  MOVLW  0F
250
00A3:  MOVWF  19
251
00A4:  MOVF   19,F
252
00A5:  BTFSC  03.2
253
00A6:  GOTO   0B8
254
....................    {  
255
....................       delay_us(IMPULS/4);  
256
00A7:  MOVLW  14
257
00A8:  MOVWF  0C
258
00A9:  DECFSZ 0C,F
259
00AA:  GOTO   0A9
260
00AB:  NOP
261
....................       if (flag) goto loop;  
262
00AC:  BTFSS  18.0
263
00AD:  GOTO   0AF
264
00AE:  GOTO   0A1
265
....................       if (!input(PRIJIMAC)) i=SYNC;  
266
00AF:  BSF    03.5
267
00B0:  BSF    05.3
268
00B1:  BCF    03.5
269
00B2:  BTFSC  05.3
270
00B3:  GOTO   0B6
271
00B4:  MOVLW  0F
272
00B5:  MOVWF  19
273
....................    }  
274
00B6:  DECF   19,F
275
00B7:  GOTO   0A4
276
....................   
277
....................    // Cekej na startovaci 1  
278
....................    while (input(PRIJIMAC)) if (flag) goto loop;  
279
00B8:  BSF    03.5
280
00B9:  BSF    05.3
281
00BA:  BCF    03.5
282
00BB:  BTFSS  05.3
283
00BC:  GOTO   0C1
284
00BD:  BTFSS  18.0
285
00BE:  GOTO   0C0
286
00BF:  GOTO   0A1
287
00C0:  GOTO   0B8
288
....................   
289
....................    if (flag) goto loop;  
290
00C1:  BTFSS  18.0
291
00C2:  GOTO   0C4
292
00C3:  GOTO   0A1
293
....................   
294
....................    // Posun na cteni prvniho datoveho bitu  
295
....................    delay_us(2*IMPULS+2*IMPULS/3);  
296
00C4:  MOVLW  DD
297
00C5:  MOVWF  0C
298
00C6:  DECFSZ 0C,F
299
00C7:  GOTO   0C6
300
00C8:  NOP
301
00C9:  NOP
302
....................   
303
....................    // Cteme bity  
304
....................    for (i=8; i>0; i--)  
305
00CA:  MOVLW  08
306
00CB:  MOVWF  19
307
00CC:  MOVF   19,F
308
00CD:  BTFSC  03.2
309
00CE:  GOTO   0E9
310
....................    {  
311
....................       data <<= 1;  
312
00CF:  BCF    03.0
313
00D0:  RLF    1B,F
314
....................       if (input(PRIJIMAC)) data |= 1;  
315
00D1:  BSF    03.5
316
00D2:  BSF    05.3
317
00D3:  BCF    03.5
318
00D4:  BTFSS  05.3
319
00D5:  GOTO   0D7
320
00D6:  BSF    1B.0
321
....................       if (flag) goto loop;  
322
00D7:  BTFSS  18.0
323
00D8:  GOTO   0DA
324
00D9:  GOTO   0A1
325
.................... output_high(PIN_B1);   // debug pin  
326
00DA:  BSF    03.5
327
00DB:  BCF    06.1
328
00DC:  BCF    03.5
329
00DD:  BSF    06.1
330
....................       delay_us(2*IMPULS+15);  
331
00DE:  MOVLW  AB
332
00DF:  MOVWF  0C
333
00E0:  DECFSZ 0C,F
334
00E1:  GOTO   0E0
335
00E2:  NOP
336
.................... output_low(PIN_B1);   // debug pin  
337
00E3:  BSF    03.5
338
00E4:  BCF    06.1
339
00E5:  BCF    03.5
340
00E6:  BCF    06.1
341
....................    }  
342
00E7:  DECF   19,F
343
00E8:  GOTO   0CC
344
....................   
345
....................    // Cteme checksum  
346
....................    check = 0;  
347
00E9:  CLRF   1C
348
....................    for (i=4; i>0; i--)  
349
00EA:  MOVLW  04
350
00EB:  MOVWF  19
351
00EC:  MOVF   19,F
352
00ED:  BTFSC  03.2
353
00EE:  GOTO   109
354
....................    {  
355
....................       check <<= 1;  
356
00EF:  BCF    03.0
357
00F0:  RLF    1C,F
358
....................       if (input(PRIJIMAC)) check |= 1;  
359
00F1:  BSF    03.5
360
00F2:  BSF    05.3
361
00F3:  BCF    03.5
362
00F4:  BTFSS  05.3
363
00F5:  GOTO   0F7
364
00F6:  BSF    1C.0
365
....................       if (flag) goto loop;  
366
00F7:  BTFSS  18.0
367
00F8:  GOTO   0FA
368
00F9:  GOTO   0A1
369
.................... output_high(PIN_B1);   // debug pin  
370
00FA:  BSF    03.5
371
00FB:  BCF    06.1
372
00FC:  BCF    03.5
373
00FD:  BSF    06.1
374
....................       delay_us(2*IMPULS+15);  
375
00FE:  MOVLW  AB
376
00FF:  MOVWF  0C
377
0100:  DECFSZ 0C,F
378
0101:  GOTO   100
379
0102:  NOP
380
.................... output_low(PIN_B1);   // debug pin  
381
0103:  BSF    03.5
382
0104:  BCF    06.1
383
0105:  BCF    03.5
384
0106:  BCF    06.1
385
....................    }  
386
0107:  DECF   19,F
387
0108:  GOTO   0EC
388
....................   
389
....................    swap(data);          // kontrola kontrolniho souctu  
390
0109:  SWAPF  1B,F
391
....................    suma = data & 0xF;     
392
010A:  MOVF   1B,W
393
010B:  ANDLW  0F
394
010C:  MOVWF  1D
395
....................    swap(data);  
396
010D:  SWAPF  1B,F
397
....................    suma += data & 0xF;  
398
010E:  MOVF   1B,W
399
010F:  ANDLW  0F
400
0110:  ADDWF  1D,F
401
....................    suma++;  
402
0111:  INCF   1D,F
403
....................    suma &= 0xF;  
404
0112:  MOVLW  0F
405
0113:  ANDWF  1D,F
406
....................    if (suma != check) goto loop;  
407
0114:  MOVF   1C,W
408
0115:  SUBWF  1D,W
409
0116:  BTFSC  03.2
410
0117:  GOTO   119
411
0118:  GOTO   0A1
412
....................   
413
....................    osa = data >> 5;  // extrahuj z ramce cislo osy a hodnotu  
414
0119:  SWAPF  1B,W
415
011A:  MOVWF  1A
416
011B:  RRF    1A,F
417
011C:  MOVLW  07
418
011D:  ANDWF  1A,F
419
....................    data &= 0x1F;  
420
011E:  MOVLW  1F
421
011F:  ANDWF  1B,F
422
....................    switch(osa)  
423
0120:  MOVLW  01
424
0121:  SUBWF  1A,W
425
0122:  ADDLW  FE
426
0123:  BTFSC  03.0
427
0124:  GOTO   12D
428
0125:  ADDLW  02
429
0126:  GOTO   12F
430
....................    {  
431
....................       case OSA_X:  
432
....................          x=data;  
433
0127:  MOVF   1B,W
434
0128:  MOVWF  14
435
....................         break;  
436
0129:  GOTO   12D
437
....................       case OSA_y:  
438
....................          y=data;  
439
012A:  MOVF   1B,W
440
012B:  MOVWF  15
441
....................         break;  
442
012C:  GOTO   12D
443
....................    }  
444
*
445
012F:  BSF    0A.0
446
0130:  BCF    0A.1
447
0131:  BCF    0A.2
448
0132:  ADDWF  02,F
449
0133:  GOTO   127
450
0134:  GOTO   12A
451
....................   
452
....................    goto loop;  
453
*
454
012D:  GOTO   0A1
455
.................... }  
456
....................  
457
012E:  SLEEP