Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         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         PRIJIMAC.ASM   8-8-2002  19:29:29         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
  00000000            00003 PRYJM   EQU     0               ;portb
118
                      00004 
119
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  3
120
 
121
 
122
LOC  OBJECT CODE     LINE SOURCE TEXT
123
  VALUE
124
 
125
0000                  00005         org     0
126
                      00006 
127
0000   2817           00007         goto    Start
128
                      00008         ;--------------------
129
0004                  00009         org     4
130
                      00010         ;--------------------
131
0004   2817           00011         goto    Start
132
                      00012 
133
                      00013 #include delay.asm
134
                      00001 ;Pro krystal 4Mhz
135
                      00002 
136
                      00003 ;--- Macro na spozdeni 1ms az 255ms ---
137
                      00004 Delay   macro   ms
138
                      00005         movlw   ms
139
                      00006         movwf   xxx
140
                      00007         call    Delay1ms        
141
                      00008         endm
142
                      00009 
143
                      00010 ;--- Macro na spozdeni 0,1ms az 2,5ms (10-250) ---
144
                      00011 Delay01 macro   us
145
                      00012         movlw   us
146
                      00013         movwf   yyy
147
                      00014         call    Delay10us
148
                      00015         
149
                      00016         nop
150
                      00017         nop                     ; Z duvodu vyrovnani poctu potrebnych taktu jako na Delay1ms
151
                      00018         nop
152
                      00019         return  
153
                      00020         endm
154
                      00021 ;--- Spozdeni v nasobcich 1ms+2us ----
155
                      00022 
156
0005                  00023 Delay1ms:
157
0005   3063           00024         movlw   99              ; 1 ms
158
0006   008C           00025         movwf   yyy             ; goto 2 takty decfsz 1 kdyz 1 jinak 2
159
0007   200C           00026         call    Delay10us
160
                      00027 
161
0008   0B8D           00028         decfsz  xxx, f
162
0009   2805           00029         goto    Delay1ms
163
000A   0000           00030         nop
164
                      00031 ;---------------------------------
165
000B   0008           00032         return                  ;2us
166
                      00033 
167
                      00034 ;--- Spozdeni v nasobcich 10us ----
168
000C                  00035 Delay10us:                      ; Prodleva (CT1 * 10us)
169
000C   0000           00036         nop     
170
000D   0000           00037         nop
171
000E   0000           00038         nop
172
000F   0000           00039         nop
173
0010   0000           00040         nop
174
0011   0000           00041         nop
175
0012   0000           00042         nop
176
0013   0B8C           00043         decfsz  yyy, f
177
0014   280C           00044         goto    Delay10us
178
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  4
179
 
180
 
181
LOC  OBJECT CODE     LINE SOURCE TEXT
182
  VALUE
183
 
184
0015   0000           00045         nop
185
0016   0008           00046         return
186
                      00047         ;-------------------------
187
                      00048 
188
                      00049 ;----------------------------
189
                      00050 ; Definice promenych
190
                      00051 ;----------------------------
191
                      00052 
192
                      00053         cblock  
193
                      00054 
194
  0000000C            00055         yyy
195
  0000000D            00056         xxx
196
                      00057 
197
                      00058         endc
198
                      00059 
199
                      00014 
200
                      00015 
201
0017                  00016 Start:
202
                      00017         page1
203
0017   1683               M         bsf     STATUS,_RP0
204
0018   3028           00018         movlw   00101000B       ; inicializace citace a prescaleru
205
0019   0081           00019         movwf   TMR0
206
001A   3000           00020         movlw   00000000B       ; konfigurace preruseni
207
001B   008B           00021         movwf   INTCON
208
                      00022 
209
                      00023         page1
210
001C   1683               M         bsf     STATUS,_RP0
211
001D   30F7           00024         movlw   11110111B       ; nastaveni portu na vstup nebo vystup
212
001E   0085           00025         movwf   PORTA           ; 1=vstup 0=vystup
213
001F   30F1           00026         movlw   11110001B
214
0020   0086           00027         movwf   PORTB
215
                      00028 
216
                      00029         ;bsf    TMR0, 7         ; vypni pull-up na PORTB (OPTION registr)
217
                      00030 
218
                      00031         page0
219
0021   1283               M         bcf     STATUS,_RP0
220
                      00032 
221
0022   0103           00033         clrw                    ; vynulovani portu
222
0023   0085           00034         movwf   PORTA
223
0024   0086           00035         movwf   PORTB
224
                      00036 
225
0025   1585           00037         bsf     PORTA, 3        ; Pull-Up na tlacitka
226
                      00038 
227
0026   1086           00039         bcf     PORTB, 1        ; zhasnuti LED
228
0027   1106           00040         bcf     PORTB, 2
229
0028   1186           00041         bcf     PORTB, 3
230
                      00042 
231
0029                  00043 MainLoop:
232
0029   1C06           00044         btfss   PORTB, PRYJM    ;cekani na impuls1
233
002A   2829           00045         goto    MainLoop
234
                      00046 
235
002B   200C           00047         call    Delay10us
236
002C   200C           00048         call    Delay10us
237
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  5
238
 
239
 
240
LOC  OBJECT CODE     LINE SOURCE TEXT
241
  VALUE
242
 
243
                      00049 
244
002D   1C06           00050         btfss   PORTB, PRYJM    ;potvrzeni impulsu1
245
002E   2829           00051         goto    MainLoop
246
                      00052 
247
002F   200C           00053         call    Delay10us
248
0030   200C           00054         call    Delay10us
249
0031                  00055 smycka:
250
0031   1806           00056         btfsc   PORTB, PRYJM
251
0032   2831           00057         goto    smycka
252
                      00058                                 ;sinchronizace
253
0033   200C           00059         call    Delay10us
254
                      00060 
255
0034                  00061 smycka1:                        ;2impuls
256
0034   1C06           00062         btfss   PORTB, PRYJM                    
257
0035   2834           00063         goto    smycka1
258
0036   200C           00064         call    Delay10us       
259
                      00065 
260
0037                  00066 smycka2:
261
0037   1C06           00067         btfss   PORTB, PRYJM
262
0038   2829           00068         goto    MainLoop
263
                      00069 
264
0039                  00070 mezera2:
265
0039   1806           00071         btfsc   PORTB, PRYJM
266
003A   2839           00072         goto    mezera2
267
                      00073 
268
003B                  00074 impuls3:
269
003B   1C06           00075         btfss   PORTB, PRYJM
270
003C   283B           00076         goto    impuls3
271
                      00077 
272
003D                  00078 mezera3:
273
003D   1806           00079         btfsc   PORTB, PRYJM
274
003E   283D           00080         goto    mezera3
275
                      00081 
276
                      00082 
277
                      00083         ;-------------------------
278
                      00084 
279
                      00085 ;----------------------------
280
                      00086 ; Definice promenych
281
                      00087 ;----------------------------
282
                      00088 
283
                      00089         cblock  
284
                      00090 
285
  0000000E            00091         CT1
286
  0000000F            00092         CT2
287
                      00093 
288
                      00094         endc
289
                      00095 
290
                      00096         end
291
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  6
292
 
293
 
294
SYMBOL TABLE
295
  LABEL                             VALUE 
296
 
297
CMP                               
298
CT1                               0000000E
299
CT2                               0000000F
300
Delay                             
301
Delay01                           
302
Delay10us                         0000000C
303
Delay1ms                          00000005
304
EEADR_0                           00000009
305
EECON1_1                          00000008
306
EECON2_1                          00000009
307
EEDATA_0                          00000008
308
FSR                               00000004
309
IND0                              00000000
310
INTCON                            0000000B
311
MainLoop                          00000029
312
PCL                               00000002
313
PCLATH                            0000000A
314
PORTA                             00000005
315
PORTB                             00000006
316
PRYJM                             00000000
317
SB                                
318
SC                                
319
SN                                
320
SNB                               
321
SNC                               
322
SNZ                               
323
SP                                
324
STATUS                            00000003
325
SZ                                
326
Start                             00000017
327
TMR0                              00000001
328
_CARRY                            00000000
329
_DC                               00000001
330
_EEIE                             00000006
331
_EEIF                             00000004
332
_EERD                             00000000
333
_EEWR                             00000001
334
_EEWREN                           00000002
335
_EEWRERR                          00000003
336
_GIE                              00000007
337
_INTE                             00000004
338
_INTF                             00000001
339
_IRP                              00000007
340
_PD                               00000003
341
_RBIE                             00000003
342
_RBIF                             00000000
343
_RP0                              00000005
344
_RP1                              00000006
345
_T0IE                             00000005
346
_T0IF                             00000002
347
_TO                               00000004
348
_ZERO                             00000002
349
__16C84__                         00000000
350
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  7
351
 
352
 
353
SYMBOL TABLE
354
  LABEL                             VALUE 
355
 
356
__16F84                           00000001
357
impuls3                           0000003B
358
mezera2                           00000039
359
mezera3                           0000003D
360
page0                             
361
page1                             
362
smycka                            00000031
363
smycka1                           00000034
364
smycka2                           00000037
365
xxx                               0000000D
366
yyy                               0000000C
367
 
368
 
369
MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
370
 
371
0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX-
372
 
373
All other memory blocks unused.
374
 
375
Program Memory Words Used:    60
376
Program Memory Words Free:   964
377
 
378
 
379
Errors   :     0
380
Warnings :     0 reported,     0 suppressed
381
Messages :     0 reported,     0 suppressed
382
 
383