Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
MPASM 02.80 Released            OVLAD.ASM   7-21-2002  12:49:43         PAGE  1
2
 
3
 
4
LOC  OBJECT CODE     LINE SOURCE TEXT
5
  VALUE
6
 
7
                      00001 #include 16C84.INC
8
                      00001 ;
9
                      00002 ; Definice registru a zakladnich maker pro 16C84
10
                      00003 ;
11
                      00004                 processor       16f84
12
                      00005                 radix   D
13
                      00006 
14
0000                  00007 __16C84__:      ; Priznak modulu 16C84
15
                      00008 
16
                      00009 ; Definice registru
17
                      00010 
18
  00000000            00011 IND0            equ     00H     ; 0&1 Pristup na neprimou adresu
19
  00000001            00012 TMR0            equ     01H     ; 0   Real Time clock counter
20
  00000002            00013 PCL             equ     02H     ; 0&1 Spodni cast PC
21
  00000003            00014 STATUS          equ     03H     ; 0&1 Stavove bity
22
  00000000            00015 _CARRY                          equ     0
23
  00000001            00016 _DC                             equ     1
24
  00000002            00017 _ZERO                           equ     2
25
  00000003            00018 _PD                             equ     3
26
  00000004            00019 _TO                             equ     4
27
  00000005            00020 _RP0                            equ     5
28
  00000006            00021 _RP1                            equ     6
29
  00000007            00022 _IRP                            equ     7
30
  00000004            00023 FSR             equ     04H     ; 0&1 Ukazatel pro neprime adresovani
31
  00000005            00024 PORTA           equ     05H     ; 0&1 Data a rizeni portu A
32
  00000006            00025 PORTB           equ     06H     ; 0&1 Data a rizeni portu B
33
  00000008            00026 EEDATA_0        equ     08H     ; 0   Data EEPROM
34
  00000008            00027 EECON1_1        equ     08H     ;   1 Rizeni EEPROM
35
  00000000            00028 _EERD                           equ     0
36
  00000001            00029 _EEWR                           equ     1
37
  00000002            00030 _EEWREN                         equ     2
38
  00000003            00031 _EEWRERR                        equ     3
39
  00000004            00032 _EEIF                           equ     4
40
  00000009            00033 EEADR_0         equ     09H     ; 0   Adresa EEPROM
41
  00000009            00034 EECON2_1        equ     09H     ;   1 Aktivacni pseudoregistr
42
  0000000A            00035 PCLATH          equ     0AH     ; 0&1 Horni cast PC pro move
43
  0000000B            00036 INTCON          equ     0BH     ; 0&1 Rizeni preruseni
44
  00000000            00037 _RBIF                           equ     0       ;
45
  00000001            00038 _INTF                           equ     1
46
  00000002            00039 _T0IF                           equ     2
47
  00000003            00040 _RBIE                           equ     3
48
  00000004            00041 _INTE                           equ     4
49
  00000005            00042 _T0IE                           equ     5
50
  00000006            00043 _EEIE                           equ     6
51
  00000007            00044 _GIE                            equ     7
52
                      00045 
53
                      00046 page0   macro
54
                      00047         bcf     STATUS,_RP0
55
                      00048         endm
56
                      00049 
57
                      00050 page1   macro
58
                      00051         bsf     STATUS,_RP0
59
                      00052         endm
60
MPASM 02.80 Released            OVLAD.ASM   7-21-2002  12:49:43         PAGE  2
61
 
62
 
63
LOC  OBJECT CODE     LINE SOURCE TEXT
64
  VALUE
65
 
66
                      00053 ;
67
                      00054 ; Sada maker pro porovnani a skoky
68
                      00055 ;
69
                      00056 
70
                      00057 ;--- Compare ---
71
                      00058 CMP     macro   ZNAK, PROCEDURA         ; if W=ZNAK then goto PROCEDURA
72
                      00059         xorlw   ZNAK                    ; if W#ZNAK then zachovej W a neskakej
73
                      00060         btfsc   STATUS,_ZERO
74
                      00061         goto    PROCEDURA
75
                      00062         xorlw   ZNAK
76
                      00063         endm
77
                      00064 
78
                      00065 ;--- Skip if Carry ---
79
                      00066 SC      macro
80
                      00067         btfss   STATUS,_CARRY
81
                      00068         endm
82
                      00069 
83
                      00070 ;--- Skip if not Carry ---
84
                      00071 SNC     macro
85
                      00072         btfsc   STATUS,_CARRY
86
                      00073         endm
87
                      00074 
88
                      00075 ;--- Skip if Zero ---
89
                      00076 SZ      macro
90
                      00077         btfss   STATUS,_ZERO
91
                      00078         endm
92
                      00079 
93
                      00080 ;--- Skip if not Zero ---
94
                      00081 SNZ     macro
95
                      00082         btfsc   STATUS,_ZERO
96
                      00083         endm
97
                      00084 
98
                      00085 ;--- Skip if Borrow ( Negative ) --- ( po odecitani )
99
                      00086 SB      macro
100
                      00087         btsfsc  STATUS,_CARRY
101
                      00088         endm
102
                      00089 SN      macro
103
                      00090         btfsc   STATUS,_CARRY
104
                      00091         endm
105
                      00092 
106
                      00093 ;--- Skip if not Borrow ( Positive ) --- ( po odecitani )
107
                      00094 SNB     macro
108
                      00095         btfss   STATUS,_CARRY
109
                      00096         endm
110
                      00097 SP      macro
111
                      00098         btfss   STATUS,_CARRY
112
                      00099         endm
113
                      00100 
114
                      00101         cblock  0CH             ; Prvni volny registr
115
                      00102         endc
116
                      00002 
117
0000                  00003         org     0
118
                      00004 
119
MPASM 02.80 Released            OVLAD.ASM   7-21-2002  12:49:43         PAGE  3
120
 
121
 
122
LOC  OBJECT CODE     LINE SOURCE TEXT
123
  VALUE
124
 
125
0000   2817           00005         goto    Start
126
                      00006         ;--------------------
127
0004                  00007         org     4
128
                      00008         ;--------------------
129
0004   2817           00009         goto    Start
130
                      00010 
131
                      00011 #include Delay.asm
132
                      00001 ;--- Macro na spozdeni 1ms az 255ms ---
133
                      00002 Delay   macro   ms
134
                      00003         movlw   ms
135
                      00004         movwf   xxx
136
                      00005         call    Delay1ms        
137
                      00006         endm
138
                      00007 
139
                      00008 ;--- Macro na spozdeni 0,1ms az 2,5ms (10-250) ---
140
                      00009 Delay01 macro   us
141
                      00010         movlw   us
142
                      00011         movwf   yyy
143
                      00012         call    us10
144
                      00013         
145
                      00014         nop
146
                      00015         nop                     ; Z duvodu vyrovnani poctu potrebnych taktu jako na Delay1ms
147
                      00016         nop
148
                      00017         return  
149
                      00018         endm
150
                      00019 ;--- Spozdeni v nasobcich 1ms+2us ----
151
                      00020 
152
0005                  00021 Delay1ms:
153
0005   3063           00022         movlw   99              ; 1 ms
154
0006   008C           00023         movwf   yyy             ; goto 2 takty decfsz 1 kdyz 1 jinak 2
155
0007   200C           00024         call    us10
156
                      00025 
157
0008   0B8D           00026         decfsz  xxx, f
158
0009   2805           00027         goto    Delay1ms
159
000A   0000           00028         nop
160
                      00029 ;---------------------------------
161
000B   0008           00030         return                  ;2us
162
                      00031 
163
                      00032 ;--- Spozdeni v nasobcich 10us ----
164
000C                  00033 us10:                   ; Prodleva (CT1 * 10us)
165
000C   0000           00034         nop     
166
000D   0000           00035         nop
167
000E   0000           00036         nop
168
000F   0000           00037         nop
169
0010   0000           00038         nop
170
0011   0000           00039         nop
171
0012   0000           00040         nop
172
0013   0B8C           00041         decfsz  yyy, f
173
0014   280C           00042         goto    us10
174
0015   0000           00043         nop
175
0016   0008           00044         return
176
                      00045         ;-------------------------
177
                      00046 
178
MPASM 02.80 Released            OVLAD.ASM   7-21-2002  12:49:43         PAGE  4
179
 
180
 
181
LOC  OBJECT CODE     LINE SOURCE TEXT
182
  VALUE
183
 
184
                      00047 ;----------------------------
185
                      00048 ; Definice promenych
186
                      00049 ;----------------------------
187
                      00050 
188
                      00051         cblock  
189
                      00052 
190
  0000000C            00053         yyy
191
  0000000D            00054         xxx
192
                      00055 
193
                      00056         endc
194
                      00057 
195
                      00012         
196
0017                  00013 Start:
197
                      00014         page1
198
0017   1683               M         bsf     STATUS,_RP0
199
0018   3000           00015         movlw   00000000B       ; inicializace citace a prescaleru
200
0019   0081           00016         movwf   TMR0
201
001A   3000           00017         movlw   00000000B       ; konfigurace preruseni
202
001B   008B           00018         movwf   INTCON
203
                      00019 
204
                      00020         page1
205
001C   1683               M         bsf     STATUS,_RP0
206
001D   3000           00021         movlw   00000000B       ; nastaveni portu na vstup nebo vystup
207
001E   0085           00022         movwf   PORTA           ; 1=vstup 0=vystup
208
001F   3043           00023         movlw   01000011B
209
0020   0086           00024         movwf   PORTB
210
                      00025 
211
0021   1781           00026         bsf     TMR0, 7         ; vypni pull-up na PORTB (OPTION registr)
212
                      00027 
213
                      00028         page0
214
0022   1283               M         bcf     STATUS,_RP0
215
                      00029 
216
0023   0103           00030         clrw                    ; vynulovani portu
217
0024   0085           00031         movwf   PORTA
218
0025   0086           00032         movwf   PORTB
219
                      00033         
220
                      00034 
221
0026                  00035 MainLoop:
222
0026   30FF           00036         movlw   255
223
0027   008E           00037         movwf   CT1
224
0028   30FC           00038         movlw   252
225
0029   008F           00039         movwf   CT2
226
002A                  00040 rozj:
227
                      00041 
228
002A   038E           00042         decf    CT1, f
229
                      00043 
230
002B   1405           00044         bsf     PORTA, 0        
231
002C   1085           00045         bcf     PORTA, 1        ;100
232
002D   1105           00046         bcf     PORTA, 2
233
002E   2046           00047         call    zap
234
                      00048 
235
002F   1405           00049         bsf     PORTA, 0        ;110
236
0030   1485           00050         bsf     PORTA, 1
237
MPASM 02.80 Released            OVLAD.ASM   7-21-2002  12:49:43         PAGE  5
238
 
239
 
240
LOC  OBJECT CODE     LINE SOURCE TEXT
241
  VALUE
242
 
243
0031   1105           00051         bcf     PORTA, 2
244
0032   2046           00052         call    zap
245
                      00053 
246
0033   1005           00054         bcf     PORTA, 0        ;010
247
0034   1485           00055         bsf     PORTA, 1
248
0035   1105           00056         bcf     PORTA, 2
249
0036   2046           00057         call    zap
250
                      00058 
251
0037   0B8F           00059         decfsz  CT2, f
252
0038   283A           00060         goto    ble
253
0039   2849           00061         goto    rychle
254
                      00062 
255
003A   1005           00063 ble:    bcf     PORTA, 0        ;011
256
003B   1485           00064         bsf     PORTA, 1
257
003C   1505           00065         bsf     PORTA, 2
258
003D   2046           00066         call    zap
259
                      00067 
260
003E   1005           00068         bcf     PORTA, 0        ;001
261
003F   1085           00069         bcf     PORTA, 1
262
0040   1505           00070         bsf     PORTA, 2
263
0041   2046           00071         call    zap
264
                      00072 
265
0042   1405           00073         bsf     PORTA, 0        ;101
266
0043   1085           00074         bcf     PORTA, 1
267
0044   1505           00075         bsf     PORTA, 2
268
0045   2046           00076         call    zap
269
                      00077 
270
0046                  00078 zap:
271
0046   080E           00079         movf    CT1, w
272
0047   008D           00080         movwf   xxx             ;xxx promena z delay.asm
273
0048   2005           00081         call    Delay1ms
274
                      00082 
275
                      00083 ;----------------------------------------------------
276
0049                  00084 rychle:
277
0049   1405           00085         bsf     PORTA, 0        
278
004A   1085           00086         bcf     PORTA, 1        ;100
279
004B   1105           00087         bcf     PORTA, 2
280
                      00088         Delay   3
281
004C   3003               M         movlw   3
282
004D   008D               M         movwf   xxx
283
004E   2005               M         call    Delay1ms        
284
                      00089 
285
                      00090 ;       bsf     PORTA, 0        ;110
286
                      00091 ;       bsf     PORTA, 1
287
                      00092 ;       bcf     PORTA, 2
288
                      00093 ;       Delay   
289
                      00094 
290
004F   1005           00095         bcf     PORTA, 0        ;010
291
0050   1485           00096         bsf     PORTA, 1
292
0051   1105           00097         bcf     PORTA, 2
293
                      00098         Delay   3
294
0052   3003               M         movlw   3
295
0053   008D               M         movwf   xxx
296
MPASM 02.80 Released            OVLAD.ASM   7-21-2002  12:49:43         PAGE  6
297
 
298
 
299
LOC  OBJECT CODE     LINE SOURCE TEXT
300
  VALUE
301
 
302
0054   2005               M         call    Delay1ms        
303
                      00099 
304
                      00100 ;       bcf     PORTA, 0        ;011
305
                      00101 ;       bsf     PORTA, 1
306
                      00102 ;       bsf     PORTA, 2
307
                      00103 ;       Delay   2
308
                      00104 
309
0055   1005           00105         bcf     PORTA, 0        ;001
310
0056   1085           00106         bcf     PORTA, 1
311
0057   1505           00107         bsf     PORTA, 2
312
                      00108         Delay   3
313
0058   3003               M         movlw   3
314
0059   008D               M         movwf   xxx
315
005A   2005               M         call    Delay1ms        
316
                      00109 
317
                      00110 ;       bsf     PORTA, 0        ;101
318
                      00111 ;       bcf     PORTA, 1
319
                      00112 ;       bsf     PORTA, 2
320
                      00113 ;       Delay   2
321
005B   2849           00114         goto    rychle
322
                      00115 ;______________________________________________________________
323
                      00116 
324
005C   1105           00117         bcf     PORTA, 2
325
005D   1085           00118         bcf     PORTA, 1
326
                      00119 
327
005E                  00120 smycka: 
328
005E   1C06           00121         btfss   PORTB, 0
329
005F   2861           00122         goto    LEDon
330
0060   285E           00123         goto    smycka
331
0061                  00124 LEDon:
332
0061   1585           00125         bsf     PORTA, 3        ;Rozsvit LED
333
                      00126         Delay   250             
334
0062   30FA               M         movlw   250
335
0063   008D               M         movwf   xxx
336
0064   2005               M         call    Delay1ms        
337
0065   1185           00127         bcf     PORTA, 3        ;Zhasni LED
338
                      00128         Delay   250             
339
0066   30FA               M         movlw   250
340
0067   008D               M         movwf   xxx
341
0068   2005               M         call    Delay1ms        
342
0069   285E           00129         goto    smycka
343
                      00130         ;---------------
344
                      00131 
345
                      00132 
346
                      00133 
347
                      00134 
348
                      00135 
349
                      00136 ;----------------------------
350
                      00137 ; Definice promenych
351
                      00138 ;----------------------------
352
                      00139 
353
                      00140         cblock  
354
                      00141 
355
MPASM 02.80 Released            OVLAD.ASM   7-21-2002  12:49:43         PAGE  7
356
 
357
 
358
LOC  OBJECT CODE     LINE SOURCE TEXT
359
  VALUE
360
 
361
  0000000E            00142         CT1
362
  0000000F            00143         CT2
363
                      00144 
364
                      00145         endc
365
                      00146 
366
                      00147         end
367
MPASM 02.80 Released            OVLAD.ASM   7-21-2002  12:49:43         PAGE  8
368
 
369
 
370
SYMBOL TABLE
371
  LABEL                             VALUE 
372
 
373
CMP                               
374
CT1                               0000000E
375
CT2                               0000000F
376
Delay                             
377
Delay01                           
378
Delay1ms                          00000005
379
EEADR_0                           00000009
380
EECON1_1                          00000008
381
EECON2_1                          00000009
382
EEDATA_0                          00000008
383
FSR                               00000004
384
IND0                              00000000
385
INTCON                            0000000B
386
LEDon                             00000061
387
MainLoop                          00000026
388
PCL                               00000002
389
PCLATH                            0000000A
390
PORTA                             00000005
391
PORTB                             00000006
392
SB                                
393
SC                                
394
SN                                
395
SNB                               
396
SNC                               
397
SNZ                               
398
SP                                
399
STATUS                            00000003
400
SZ                                
401
Start                             00000017
402
TMR0                              00000001
403
_CARRY                            00000000
404
_DC                               00000001
405
_EEIE                             00000006
406
_EEIF                             00000004
407
_EERD                             00000000
408
_EEWR                             00000001
409
_EEWREN                           00000002
410
_EEWRERR                          00000003
411
_GIE                              00000007
412
_INTE                             00000004
413
_INTF                             00000001
414
_IRP                              00000007
415
_PD                               00000003
416
_RBIE                             00000003
417
_RBIF                             00000000
418
_RP0                              00000005
419
_RP1                              00000006
420
_T0IE                             00000005
421
_T0IF                             00000002
422
_TO                               00000004
423
_ZERO                             00000002
424
__16C84__                         00000000
425
__16F84                           00000001
426
MPASM 02.80 Released            OVLAD.ASM   7-21-2002  12:49:43         PAGE  9
427
 
428
 
429
SYMBOL TABLE
430
  LABEL                             VALUE 
431
 
432
ble                               0000003A
433
page0                             
434
page1                             
435
rozj                              0000002A
436
rychle                            00000049
437
smycka                            0000005E
438
us10                              0000000C
439
xxx                               0000000D
440
yyy                               0000000C
441
zap                               00000046
442
 
443
 
444
MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
445
 
446
0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
447
0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX------ ----------------
448
 
449
All other memory blocks unused.
450
 
451
Program Memory Words Used:   103
452
Program Memory Words Free:   921
453
 
454
 
455
Errors   :     0
456
Warnings :     0 reported,     0 suppressed
457
Messages :     0 reported,     0 suppressed
458
 
459