Subversion Repositories svnkaklik

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         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             MAIN.ASM   8-9-2002  12:26:04         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
  00000001            00003 vys     EQU     1       ;vystupni portB protokol.asm
118
  00000002            00004 C1      EQU     2       ;pripojeni C1 na port B
119
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  3
120
 
121
 
122
LOC  OBJECT CODE     LINE SOURCE TEXT
123
  VALUE
124
 
125
  00000003            00005 C2      EQU     3       ;ptipojeni C2 na port B
126
                      00006 
127
0000                  00007         org     0
128
                      00008 
129
0000   284D           00009         goto    Start
130
                      00010         ;--------------------
131
0004                  00011         org     4
132
                      00012         ;--------------------
133
0004   284D           00013         goto    Start
134
                      00014 
135
                      00015 #include Delay.asm
136
                      00001 ;Pro krystal 4Mhz
137
                      00002 
138
                      00003 ;--- Macro na spozdeni 1ms az 255ms ---
139
                      00004 Delay   macro   ms
140
                      00005         movlw   ms
141
                      00006         movwf   xxx
142
                      00007         call    Delay1ms        
143
                      00008         endm
144
                      00009 
145
                      00010 ;--- Macro na spozdeni 0,1ms az 2,5ms (10-250) ---
146
                      00011 Delay01 macro   us
147
                      00012         movlw   us
148
                      00013         movwf   yyy
149
                      00014         call    Delay10us
150
                      00015         
151
                      00016         nop
152
                      00017         nop                     ; Z duvodu vyrovnani poctu potrebnych taktu jako na Delay1ms
153
                      00018         nop
154
                      00019         return  
155
                      00020         endm
156
                      00021 ;--- Spozdeni v nasobcich 1ms+2us ----
157
                      00022 
158
0005                  00023 Delay1ms:
159
0005   3063           00024         movlw   99              ; 1 ms
160
0006   008C           00025         movwf   yyy             ; goto 2 takty decfsz 1 kdyz 1 jinak 2
161
0007   200C           00026         call    Delay10us
162
                      00027 
163
0008   0B8D           00028         decfsz  xxx, f
164
0009   2805           00029         goto    Delay1ms
165
000A   0000           00030         nop
166
                      00031 ;---------------------------------
167
000B   0008           00032         return                  ;2us
168
                      00033 
169
                      00034 ;--- Spozdeni v nasobcich 10us ----
170
000C                  00035 Delay10us:                      ; Prodleva (CT1 * 10us)
171
000C   0000           00036         nop     
172
000D   0000           00037         nop
173
000E   0000           00038         nop
174
000F   0000           00039         nop
175
0010   0000           00040         nop
176
0011   0000           00041         nop
177
0012   0000           00042         nop
178
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  4
179
 
180
 
181
LOC  OBJECT CODE     LINE SOURCE TEXT
182
  VALUE
183
 
184
0013   0B8C           00043         decfsz  yyy, f
185
0014   280C           00044         goto    Delay10us
186
0015   0000           00045         nop
187
0016   0008           00046         return
188
                      00047         ;-------------------------
189
                      00048 
190
                      00049 ;----------------------------
191
                      00050 ; Definice promenych
192
                      00051 ;----------------------------
193
                      00052 
194
                      00053         cblock  
195
                      00054 
196
  0000000C            00055         yyy
197
  0000000D            00056         xxx
198
                      00057 
199
                      00058         endc
200
                      00059 
201
                      00016 #include Protokol.asm
202
0017                  00001 Sinchro:
203
0017   1486           00002         bsf     PORTB, vys
204
0018   200C           00003         call    Delay10us               
205
0019   200C           00004         call    Delay10us       
206
001A   200C           00005         call    Delay10us       
207
001B   1086           00006         bcf     PORTB, vys              ; 1. impuls (30us)
208
001C   200C           00007         call    Delay10us
209
001D   200C           00008         call    Delay10us
210
001E   200C           00009         call    Delay10us               
211
001F   1486           00010         bsf     PORTB, vys
212
0020   200C           00011         call    Delay10us               
213
0021   200C           00012         call    Delay10us       
214
0022   1086           00013         bcf     PORTB, vys              ; 2. impuls (20us)
215
0023   200C           00014         call    Delay10us
216
0024   200C           00015         call    Delay10us                       
217
0025   1486           00016         bsf     PORTB, vys
218
0026   200C           00017         call    Delay10us               
219
0027   1086           00018         bcf     PORTB, vys              ; 3. impuls (10us)
220
0028   200C           00019         call    Delay10us
221
                      00020         
222
                      00021         ;return
223
                      00022 
224
                      00023         ;-------------------------
225
0029                  00024 Protokol:
226
0029   3008           00025         movlw   8
227
002A   008F           00026         movwf   Bity                    ; nastaveni slova
228
002B   2017           00027         call    Sinchro
229
002C                  00028 VysBit:
230
002C   1C10           00029         btfss   Ramec, 0
231
002D   2033           00030         call    frek0
232
002E   2040           00031         call    frek1
233
002F                  00032 Rotace:
234
002F   0C90           00033         rrf     Ramec, f
235
0030   0B8F           00034         decfsz  Bity, f
236
0031   282C           00035         goto    VysBit
237
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  5
238
 
239
 
240
LOC  OBJECT CODE     LINE SOURCE TEXT
241
  VALUE
242
 
243
0032   0008           00036         return
244
                      00037 
245
                      00038         ;-------------------------
246
0033                  00039 frek0:
247
0033   303C           00040         movlw   60
248
0034   008E           00041         movwf   Frek
249
0035                  00042 smycka1:
250
0035   1486           00043         bsf     PORTB, vys                      ; 2000 Hz       60 impulsu      
251
                      00044         Delay   50
252
0036   3032               M         movlw   50
253
0037   008D               M         movwf   xxx
254
0038   2005               M         call    Delay1ms        
255
0039   1086           00045         bcf     PORTB, vys
256
                      00046         Delay   50
257
003A   3032               M         movlw   50
258
003B   008D               M         movwf   xxx
259
003C   2005               M         call    Delay1ms        
260
003D   0B8E           00047         decfsz  Frek,f
261
003E   2835           00048         goto    smycka1
262
003F   202F           00049         call    Rotace          
263
                      00050         ;-------------------------
264
0040                  00051 frek1:  
265
0040   302D           00052         movlw   45
266
0041   008E           00053         movwf   Frek
267
0042                  00054 smycka2:
268
0042   1486           00055         bsf     PORTB, vys                      ; 1500 Hz       45 impulsu
269
                      00056         Delay   150
270
0043   3096               M         movlw   150
271
0044   008D               M         movwf   xxx
272
0045   2005               M         call    Delay1ms        
273
0046   1086           00057         bcf     PORTB, vys
274
                      00058         Delay   150
275
0047   3096               M         movlw   150
276
0048   008D               M         movwf   xxx
277
0049   2005               M         call    Delay1ms        
278
004A   0B8E           00059         decfsz  Frek,f
279
004B   2842           00060         goto    smycka2
280
004C   202F           00061         call    Rotace                          
281
                      00062         ;-------------------------
282
                      00063 
283
                      00064 
284
                      00065 ;----------------------------
285
                      00066 ; Definice promenych
286
                      00067 ;----------------------------
287
                      00068 
288
                      00069         cblock  
289
                      00070         
290
  0000000E            00071         Frek
291
  0000000F            00072         Bity
292
  00000010            00073         Ramec
293
                      00074         
294
                      00075         endc
295
004D                  00017 Start:
296
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  6
297
 
298
 
299
LOC  OBJECT CODE     LINE SOURCE TEXT
300
  VALUE
301
 
302
                      00018         page1
303
004D   1683               M         bsf     STATUS,_RP0
304
004E   3000           00019         movlw   00000000B       ; inicializace citace a prescaleru
305
004F   0081           00020         movwf   TMR0
306
0050   3000           00021         movlw   00000000B       ; konfigurace preruseni
307
0051   008B           00022         movwf   INTCON
308
                      00023 
309
                      00024         page1
310
0052   1683               M         bsf     STATUS,_RP0
311
0053   30F3           00025         movlw   11110011B       ; nastaveni portu na vstup nebo vystup
312
0054   0085           00026         movwf   PORTA           ; 1=vstup 0=vystup
313
0055   30F1           00027         movlw   11110001B
314
0056   0086           00028         movwf   PORTB
315
                      00029 
316
0057   1781           00030         bsf     TMR0, 7         ; vypni pull-up na PORTB (OPTION registr)
317
                      00031 
318
                      00032         page0
319
0058   1283               M         bcf     STATUS,_RP0
320
                      00033 
321
0059   0103           00034         clrw                    ; vynulovani portu
322
005A   0085           00035         movwf   PORTA
323
005B   0086           00036         movwf   PORTB
324
                      00037 
325
005C   1585           00038         bsf     PORTA, 3        ; Pull-Up na tlacitka
326
                      00039 
327
005D   1086           00040         bcf     PORTB, 1        ; zhasnuti LED
328
005E   1106           00041         bcf     PORTB, 2
329
005F   1186           00042         bcf     PORTB, 3
330
                      00043 
331
0060                  00044 MainLoop:
332
0060   3002           00045         movlw   2
333
0061   0091           00046         movwf   volani          ; Nastavi pocet volani procedury vybito 
334
0062   1506           00047         bsf     PORTB, C1       ; Nabiti kondenzatoru1
335
0063   1586           00048         bsf     PORTB, C2       ; Nabiti kondenzatoru2
336
0064                  00049 dal:
337
0064   1D05           00050         btfss   PORTA, C1       ; Test kondenzatoru1
338
0065   206B           00051         call    vibito
339
                      00052 
340
0066   1D86           00053         btfss   PORTB, C2       ; Test kondenzatoru2
341
0067   206B           00054         call    vibito
342
                      00055 
343
0068   0A90           00056         incf    Ramec, f
344
0069   2864           00057         goto    dal
345
006A   2860           00058         goto    MainLoop
346
                      00059         ;---------------
347
                      00060 
348
006B                  00061 vibito:
349
006B   3004           00062         movlw   4
350
006C   0092           00063         movwf   CT1             ; uvolneni mista
351
006D                  00064 zapis:  
352
006D   0D90           00065         rlf     Ramec, f
353
006E   0B92           00066         decfsz  CT1, f
354
006F   286D           00067         goto    zapis
355
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  7
356
 
357
 
358
LOC  OBJECT CODE     LINE SOURCE TEXT
359
  VALUE
360
 
361
0070   0B91           00068         decfsz  volani, f
362
                      00069 
363
0071   2029           00070         call    Protokol
364
                      00071 
365
0072   2860           00072         goto    MainLoop
366
                      00073 
367
                      00074 
368
                      00075 ;----------------------------
369
                      00076 ; Definice promenych
370
                      00077 ;----------------------------
371
                      00078 
372
                      00079         cblock  
373
                      00080 
374
  00000011            00081         volani
375
  00000012            00082         CT1
376
                      00083 
377
                      00084         endc
378
                      00085 
379
                      00086         end
380
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  8
381
 
382
 
383
SYMBOL TABLE
384
  LABEL                             VALUE 
385
 
386
Bity                              0000000F
387
C1                                00000002
388
C2                                00000003
389
CMP                               
390
CT1                               00000012
391
Delay                             
392
Delay01                           
393
Delay10us                         0000000C
394
Delay1ms                          00000005
395
EEADR_0                           00000009
396
EECON1_1                          00000008
397
EECON2_1                          00000009
398
EEDATA_0                          00000008
399
FSR                               00000004
400
Frek                              0000000E
401
IND0                              00000000
402
INTCON                            0000000B
403
MainLoop                          00000060
404
PCL                               00000002
405
PCLATH                            0000000A
406
PORTA                             00000005
407
PORTB                             00000006
408
Protokol                          00000029
409
Ramec                             00000010
410
Rotace                            0000002F
411
SB                                
412
SC                                
413
SN                                
414
SNB                               
415
SNC                               
416
SNZ                               
417
SP                                
418
STATUS                            00000003
419
SZ                                
420
Sinchro                           00000017
421
Start                             0000004D
422
TMR0                              00000001
423
VysBit                            0000002C
424
_CARRY                            00000000
425
_DC                               00000001
426
_EEIE                             00000006
427
_EEIF                             00000004
428
_EERD                             00000000
429
_EEWR                             00000001
430
_EEWREN                           00000002
431
_EEWRERR                          00000003
432
_GIE                              00000007
433
_INTE                             00000004
434
_INTF                             00000001
435
_IRP                              00000007
436
_PD                               00000003
437
_RBIE                             00000003
438
_RBIF                             00000000
439
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  9
440
 
441
 
442
SYMBOL TABLE
443
  LABEL                             VALUE 
444
 
445
_RP0                              00000005
446
_RP1                              00000006
447
_T0IE                             00000005
448
_T0IF                             00000002
449
_TO                               00000004
450
_ZERO                             00000002
451
__16C84__                         00000000
452
__16F84                           00000001
453
dal                               00000064
454
frek0                             00000033
455
frek1                             00000040
456
page0                             
457
page1                             
458
smycka1                           00000035
459
smycka2                           00000042
460
vibito                            0000006B
461
volani                            00000011
462
vys                               00000001
463
xxx                               0000000D
464
yyy                               0000000C
465
zapis                             0000006D
466
 
467
 
468
MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
469
 
470
0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
471
0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXX-------------
472
 
473
All other memory blocks unused.
474
 
475
Program Memory Words Used:   112
476
Program Memory Words Free:   912
477
 
478
 
479
Errors   :     0
480
Warnings :     0 reported,     0 suppressed
481
Messages :     0 reported,     0 suppressed
482
 
483