Subversion Repositories svnkaklik

Rev

Go to most recent revision | Blame | Last modification | View Log | Download

MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00001 #include 16C84.INC
                      00001 ;
                      00002 ; Definice registru a zakladnich maker pro 16C84
                      00003 ;
                      00004                 processor       16f84
                      00005                 radix   D
                      00006 
0000                  00007 __16C84__:      ; Priznak modulu 16C84
                      00008 
                      00009 ; Definice registru
                      00010 
  00000000            00011 IND0            equ     00H     ; 0&1 Pristup na neprimou adresu
  00000001            00012 TMR0            equ     01H     ; 0   Real Time clock counter
  00000002            00013 PCL             equ     02H     ; 0&1 Spodni cast PC
  00000003            00014 STATUS          equ     03H     ; 0&1 Stavove bity
  00000000            00015 _CARRY                          equ     0
  00000001            00016 _DC                             equ     1
  00000002            00017 _ZERO                           equ     2
  00000003            00018 _PD                             equ     3
  00000004            00019 _TO                             equ     4
  00000005            00020 _RP0                            equ     5
  00000006            00021 _RP1                            equ     6
  00000007            00022 _IRP                            equ     7
  00000004            00023 FSR             equ     04H     ; 0&1 Ukazatel pro neprime adresovani
  00000005            00024 PORTA           equ     05H     ; 0&1 Data a rizeni portu A
  00000006            00025 PORTB           equ     06H     ; 0&1 Data a rizeni portu B
  00000008            00026 EEDATA_0        equ     08H     ; 0   Data EEPROM
  00000008            00027 EECON1_1        equ     08H     ;   1 Rizeni EEPROM
  00000000            00028 _EERD                           equ     0
  00000001            00029 _EEWR                           equ     1
  00000002            00030 _EEWREN                         equ     2
  00000003            00031 _EEWRERR                        equ     3
  00000004            00032 _EEIF                           equ     4
  00000009            00033 EEADR_0         equ     09H     ; 0   Adresa EEPROM
  00000009            00034 EECON2_1        equ     09H     ;   1 Aktivacni pseudoregistr
  0000000A            00035 PCLATH          equ     0AH     ; 0&1 Horni cast PC pro move
  0000000B            00036 INTCON          equ     0BH     ; 0&1 Rizeni preruseni
  00000000            00037 _RBIF                           equ     0       ;
  00000001            00038 _INTF                           equ     1
  00000002            00039 _T0IF                           equ     2
  00000003            00040 _RBIE                           equ     3
  00000004            00041 _INTE                           equ     4
  00000005            00042 _T0IE                           equ     5
  00000006            00043 _EEIE                           equ     6
  00000007            00044 _GIE                            equ     7
                      00045 
                      00046 page0   macro
                      00047         bcf     STATUS,_RP0
                      00048         endm
                      00049 
                      00050 page1   macro
                      00051         bsf     STATUS,_RP0
                      00052         endm
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE  2


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00053 ;
                      00054 ; Sada maker pro porovnani a skoky
                      00055 ;
                      00056 
                      00057 ;--- Compare ---
                      00058 CMP     macro   ZNAK, PROCEDURA         ; if W=ZNAK then goto PROCEDURA
                      00059         xorlw   ZNAK                    ; if W#ZNAK then zachovej W a neskakej
                      00060         btfsc   STATUS,_ZERO
                      00061         goto    PROCEDURA
                      00062         xorlw   ZNAK
                      00063         endm
                      00064 
                      00065 ;--- Skip if Carry ---
                      00066 SC      macro
                      00067         btfss   STATUS,_CARRY
                      00068         endm
                      00069 
                      00070 ;--- Skip if not Carry ---
                      00071 SNC     macro
                      00072         btfsc   STATUS,_CARRY
                      00073         endm
                      00074 
                      00075 ;--- Skip if Zero ---
                      00076 SZ      macro
                      00077         btfss   STATUS,_ZERO
                      00078         endm
                      00079 
                      00080 ;--- Skip if not Zero ---
                      00081 SNZ     macro
                      00082         btfsc   STATUS,_ZERO
                      00083         endm
                      00084 
                      00085 ;--- Skip if Borrow ( Negative ) --- ( po odecitani )
                      00086 SB      macro
                      00087         btsfsc  STATUS,_CARRY
                      00088         endm
                      00089 SN      macro
                      00090         btfsc   STATUS,_CARRY
                      00091         endm
                      00092 
                      00093 ;--- Skip if not Borrow ( Positive ) --- ( po odecitani )
                      00094 SNB     macro
                      00095         btfss   STATUS,_CARRY
                      00096         endm
                      00097 SP      macro
                      00098         btfss   STATUS,_CARRY
                      00099         endm
                      00100 
                      00101         cblock  0CH             ; Prvni volny registr
                      00102         endc
                      00002 
0000                  00003         org     0
                      00004 
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE  3


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0000   281B           00005         goto    Start
                      00006         ;--------------------
0004                  00007         org     4
                      00008         ;--------------------
0004   281B           00009         goto    Start
                      00010 
                      00011 #include Delay.asm
                      00001 ;--- Macro na spozdeni 1ms az 255ms ---
                      00002 Delay   macro   ms
                      00003         movlw   ms
                      00004         movwf   xxx
                      00005         call    Delay1ms        
                      00006         endm
                      00007 
                      00008 ;--- Macro na spozdeni 0,1ms az 2,5ms (10-250) ---
                      00009 Delay01 macro   us
                      00010         movlw   us
                      00011         movwf   yyy
                      00012         call    us10
                      00013         
                      00014         nop
                      00015         nop                     ; Z duvodu vyrovnani poctu potrebnych taktu jako na Delay1ms
                      00016         nop
                      00017         return  
                      00018         endm
                      00019 ;--- Spozdeni v nasobcich 1ms+2us ----
                      00020 
0005                  00021 Delay1ms:
0005   3063           00022         movlw   99              ; 1 ms
0006   008C           00023         movwf   yyy             ; goto 2 takty decfsz 1 kdyz 1 jinak 2
0007   200C           00024         call    us10
                      00025 
0008   0B8D           00026         decfsz  xxx, f
0009   2805           00027         goto    Delay1ms
000A   0000           00028         nop
                      00029 ;---------------------------------
000B   0008           00030         return                  ;2us
                      00031 
                      00032 ;--- Spozdeni v nasobcich 10us ----
000C                  00033 us10:                   ; Prodleva (CT1 * 10us)
000C   0000           00034         nop     
000D   0000           00035         nop
000E   0000           00036         nop
000F   0000           00037         nop
0010   0000           00038         nop
0011   0000           00039         nop
0012   0000           00040         nop
0013   0B8C           00041         decfsz  yyy, f
0014   280C           00042         goto    us10
0015   0000           00043         nop
0016   0008           00044         return
                      00045         ;-------------------------
                      00046 
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE  4


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00047 ;----------------------------
                      00048 ; Definice promenych
                      00049 ;----------------------------
                      00050 
                      00051         cblock  
                      00052 
  0000000C            00053         yyy
  0000000D            00054         xxx
                      00055 
                      00056         endc
                      00057 
                      00012         
0017                  00013 zap:
0017   080F           00014         movf    CT2, w
0018   008D           00015         movwf   xxx             ;xxx promena z delay.asm
0019   2005           00016         call    Delay1ms
001A   0008           00017         return
                      00018 ;----------------------------------------------------
                      00019 
001B                  00020 Start:
                      00021         page1
001B   1683               M         bsf     STATUS,_RP0
001C   3000           00022         movlw   00000000B       ; inicializace citace a prescaleru
001D   0081           00023         movwf   TMR0
001E   3000           00024         movlw   00000000B       ; konfigurace preruseni
001F   008B           00025         movwf   INTCON
                      00026 
                      00027         page1
0020   1683               M         bsf     STATUS,_RP0
0021   3000           00028         movlw   00000000B       ; nastaveni portu na vstup nebo vystup
0022   0085           00029         movwf   PORTA           ; 1=vstup 0=vystup
0023   3043           00030         movlw   01000011B
0024   0086           00031         movwf   PORTB
                      00032 
0025   1781           00033         bsf     TMR0, 7         ; vypni pull-up na PORTB (OPTION registr)
                      00034 
                      00035         page0
0026   1283               M         bcf     STATUS,_RP0
                      00036 
0027   0103           00037         clrw                    ; vynulovani portu
0028   0085           00038         movwf   PORTA
0029   0086           00039         movwf   PORTB
                      00040         
                      00041 
002A                  00042 MainLoop:
                      00043 
002A   30FA           00044         movlw   250             ; Pocet otacek jednoho kroku zrychleni
002B   0090           00045         movwf   CT3
                      00046         
002C   30AA           00047         movlw   170
002D   0091           00048         movwf   CT4
                      00049 
002E   3096           00050         movlw   150
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE  5


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

002F   0092           00051         movwf   CT5
                      00052 
0030   30FA           00053         movlw   250
0031   0092           00054         movwf   CT5
                      00055 
0032                  00056 rozj:                           ; Rozjezd
0032   1405           00057         bsf     PORTA, 0        
0033   1085           00058         bcf     PORTA, 1        ;100
0034   1105           00059         bcf     PORTA, 2
                      00060         Delay   6
0035   3006               M         movlw   6
0036   008D               M         movwf   xxx
0037   2005               M         call    Delay1ms        
                      00061         
                      00062 
0038   1405           00063         bsf     PORTA, 0        ;110
0039   1485           00064         bsf     PORTA, 1
003A   1105           00065         bcf     PORTA, 2
                      00066         Delay   6
003B   3006               M         movlw   6
003C   008D               M         movwf   xxx
003D   2005               M         call    Delay1ms        
                      00067 
003E   1005           00068         bcf     PORTA, 0        ;010
003F   1485           00069         bsf     PORTA, 1
0040   1105           00070         bcf     PORTA, 2
                      00071         Delay   5
0041   3005               M         movlw   5
0042   008D               M         movwf   xxx
0043   2005               M         call    Delay1ms        
                      00072 
0044   1005           00073         bcf     PORTA, 0        ;011
0045   1485           00074         bsf     PORTA, 1
0046   1505           00075         bsf     PORTA, 2
                      00076         Delay   5
0047   3005               M         movlw   5
0048   008D               M         movwf   xxx
0049   2005               M         call    Delay1ms        
                      00077 
004A   1005           00078         bcf     PORTA, 0        ;001
004B   1085           00079         bcf     PORTA, 1
004C   1505           00080         bsf     PORTA, 2
                      00081         Delay   5
004D   3005               M         movlw   5
004E   008D               M         movwf   xxx
004F   2005               M         call    Delay1ms        
                      00082 
0050   1405           00083         bsf     PORTA, 0        ;101
0051   1085           00084         bcf     PORTA, 1
0052   1505           00085         bsf     PORTA, 2
                      00086         Delay   5
0053   3005               M         movlw   5
0054   008D               M         movwf   xxx
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE  6


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0055   2005               M         call    Delay1ms        
                      00087 
0056   0B90           00088         decfsz  CT3, f
0057   2832           00089         goto    rozj
                      00090 
                      00091 
0058                  00092 rychle:
0058   1405           00093         bsf     PORTA, 0        
0059   1085           00094         bcf     PORTA, 1        ;100
005A   1105           00095         bcf     PORTA, 2
                      00096         Delay   3
005B   3003               M         movlw   3
005C   008D               M         movwf   xxx
005D   2005               M         call    Delay1ms        
                      00097 
005E   3000           00098         movlw   0
005F   0085           00099         movwf   PORTA
                      00100         Delay   5
0060   3005               M         movlw   5
0061   008D               M         movwf   xxx
0062   2005               M         call    Delay1ms        
                      00101 
0063   1005           00102         bcf     PORTA, 0        ;010
0064   1485           00103         bsf     PORTA, 1
0065   1105           00104         bcf     PORTA, 2
                      00105         Delay   3
0066   3003               M         movlw   3
0067   008D               M         movwf   xxx
0068   2005               M         call    Delay1ms        
                      00106 
0069   3000           00107         movlw   0
006A   0085           00108         movwf   PORTA
                      00109         Delay   5
006B   3005               M         movlw   5
006C   008D               M         movwf   xxx
006D   2005               M         call    Delay1ms        
                      00110 
006E   1005           00111         bcf     PORTA, 0        ;001
006F   1085           00112         bcf     PORTA, 1
0070   1505           00113         bsf     PORTA, 2
                      00114         Delay   3
0071   3003               M         movlw   3
0072   008D               M         movwf   xxx
0073   2005               M         call    Delay1ms        
                      00115 
0074   3000           00116         movlw   0
0075   0085           00117         movwf   PORTA
                      00118         Delay   5
0076   3005               M         movlw   5
0077   008D               M         movwf   xxx
0078   2005               M         call    Delay1ms        
                      00119 
0079   0B91           00120         decfsz  CT4, f
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE  7


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

007A   2858           00121         goto    rychle
                      00122 
007B                  00123 rychle2:
                      00124 
007B   1405           00125         bsf     PORTA, 0        
007C   1085           00126         bcf     PORTA, 1        ;100
007D   1105           00127         bcf     PORTA, 2
                      00128         Delay   3
007E   3003               M         movlw   3
007F   008D               M         movwf   xxx
0080   2005               M         call    Delay1ms        
                      00129 
0081   3000           00130         movlw   0
0082   0085           00131         movwf   PORTA
                      00132         Delay   3
0083   3003               M         movlw   3
0084   008D               M         movwf   xxx
0085   2005               M         call    Delay1ms        
                      00133 
0086   1005           00134         bcf     PORTA, 0        ;010
0087   1485           00135         bsf     PORTA, 1
0088   1105           00136         bcf     PORTA, 2
                      00137         Delay   3
0089   3003               M         movlw   3
008A   008D               M         movwf   xxx
008B   2005               M         call    Delay1ms        
                      00138 
008C   3000           00139         movlw   0
008D   0085           00140         movwf   PORTA
                      00141         Delay   3
008E   3003               M         movlw   3
008F   008D               M         movwf   xxx
0090   2005               M         call    Delay1ms        
                      00142 
0091   1005           00143         bcf     PORTA, 0        ;001
0092   1085           00144         bcf     PORTA, 1
0093   1505           00145         bsf     PORTA, 2
                      00146         Delay   3
0094   3003               M         movlw   3
0095   008D               M         movwf   xxx
0096   2005               M         call    Delay1ms        
                      00147 
0097   3000           00148         movlw   0
0098   0085           00149         movwf   PORTA
                      00150         Delay   3
0099   3003               M         movlw   3
009A   008D               M         movwf   xxx
009B   2005               M         call    Delay1ms        
009C   0B92           00151         decfsz  CT5, f
009D   287B           00152         goto    rychle2
                      00153 
009E                  00154 rychle3:
009E   1405           00155         bsf     PORTA, 0        
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE  8


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

009F   1085           00156         bcf     PORTA, 1        ;100
00A0   1105           00157         bcf     PORTA, 2
                      00158         Delay   3
00A1   3003               M         movlw   3
00A2   008D               M         movwf   xxx
00A3   2005               M         call    Delay1ms        
                      00159 
00A4   3000           00160         movlw   0
00A5   0085           00161         movwf   PORTA
                      00162         Delay   2
00A6   3002               M         movlw   2
00A7   008D               M         movwf   xxx
00A8   2005               M         call    Delay1ms        
                      00163 
00A9   1005           00164         bcf     PORTA, 0        ;010
00AA   1485           00165         bsf     PORTA, 1
00AB   1105           00166         bcf     PORTA, 2
                      00167         Delay   3
00AC   3003               M         movlw   3
00AD   008D               M         movwf   xxx
00AE   2005               M         call    Delay1ms        
                      00168 
00AF   3000           00169         movlw   0
00B0   0085           00170         movwf   PORTA
                      00171         Delay   2
00B1   3002               M         movlw   2
00B2   008D               M         movwf   xxx
00B3   2005               M         call    Delay1ms        
                      00172 
00B4   1005           00173         bcf     PORTA, 0        ;001
00B5   1085           00174         bcf     PORTA, 1
00B6   1505           00175         bsf     PORTA, 2
                      00176         Delay   3
00B7   3003               M         movlw   3
00B8   008D               M         movwf   xxx
00B9   2005               M         call    Delay1ms        
                      00177 
00BA   3000           00178         movlw   0
00BB   0085           00179         movwf   PORTA
                      00180         Delay   2
00BC   3002               M         movlw   2
00BD   008D               M         movwf   xxx
00BE   2005               M         call    Delay1ms        
00BF   0B90           00181         decfsz  CT3, f
00C0   289E           00182         goto    rychle3
                      00183 
00C1                  00184 rychle4:
00C1   1405           00185         bsf     PORTA, 0        
00C2   1085           00186         bcf     PORTA, 1        ;100
00C3   1105           00187         bcf     PORTA, 2
                      00188         Delay   2
00C4   3002               M         movlw   2
00C5   008D               M         movwf   xxx
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE  9


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

00C6   2005               M         call    Delay1ms        
                      00189 
00C7   3000           00190         movlw   0
00C8   0085           00191         movwf   PORTA
                      00192         Delay   2
00C9   3002               M         movlw   2
00CA   008D               M         movwf   xxx
00CB   2005               M         call    Delay1ms        
                      00193 
00CC   1005           00194         bcf     PORTA, 0        ;010
00CD   1485           00195         bsf     PORTA, 1
00CE   1105           00196         bcf     PORTA, 2
                      00197         Delay   2
00CF   3002               M         movlw   2
00D0   008D               M         movwf   xxx
00D1   2005               M         call    Delay1ms        
                      00198 
00D2   3000           00199         movlw   0
00D3   0085           00200         movwf   PORTA
                      00201         Delay   2
00D4   3002               M         movlw   2
00D5   008D               M         movwf   xxx
00D6   2005               M         call    Delay1ms        
                      00202 
00D7   1005           00203         bcf     PORTA, 0        ;001
00D8   1085           00204         bcf     PORTA, 1
00D9   1505           00205         bsf     PORTA, 2
                      00206         Delay   2
00DA   3002               M         movlw   2
00DB   008D               M         movwf   xxx
00DC   2005               M         call    Delay1ms        
                      00207 
00DD   3000           00208         movlw   0
00DE   0085           00209         movwf   PORTA
                      00210         Delay   2
00DF   3002               M         movlw   2
00E0   008D               M         movwf   xxx
00E1   2005               M         call    Delay1ms        
                      00211 
00E2   28C1           00212         goto    rychle4
                      00213 ;______________________________________________________________
                      00214 
                      00215 ;----------------------------
                      00216 ; Definice promenych
                      00217 ;----------------------------
                      00218 
                      00219         cblock  
                      00220 
  0000000E            00221         CT1
  0000000F            00222         CT2
  00000010            00223         CT3
  00000011            00224         CT4
  00000012            00225         CT5
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE 10


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

  00000013            00226         CT6
                      00227         endc
                      00228 
                      00229         end
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE 11


SYMBOL TABLE
  LABEL                             VALUE 

CMP                               
CT1                               0000000E
CT2                               0000000F
CT3                               00000010
CT4                               00000011
CT5                               00000012
CT6                               00000013
Delay                             
Delay01                           
Delay1ms                          00000005
EEADR_0                           00000009
EECON1_1                          00000008
EECON2_1                          00000009
EEDATA_0                          00000008
FSR                               00000004
IND0                              00000000
INTCON                            0000000B
MainLoop                          0000002A
PCL                               00000002
PCLATH                            0000000A
PORTA                             00000005
PORTB                             00000006
SB                                
SC                                
SN                                
SNB                               
SNC                               
SNZ                               
SP                                
STATUS                            00000003
SZ                                
Start                             0000001B
TMR0                              00000001
_CARRY                            00000000
_DC                               00000001
_EEIE                             00000006
_EEIF                             00000004
_EERD                             00000000
_EEWR                             00000001
_EEWREN                           00000002
_EEWRERR                          00000003
_GIE                              00000007
_INTE                             00000004
_INTF                             00000001
_IRP                              00000007
_PD                               00000003
_RBIE                             00000003
_RBIF                             00000000
_RP0                              00000005
_RP1                              00000006
_T0IE                             00000005
_T0IF                             00000002
_TO                               00000004
MPASM 02.80 Released           BUDIC1.ASM   7-30-2002  15:15:48         PAGE 12


SYMBOL TABLE
  LABEL                             VALUE 

_ZERO                             00000002
__16C84__                         00000000
__16F84                           00000001
page0                             
page1                             
rozj                              00000032
rychle                            00000058
rychle2                           0000007B
rychle3                           0000009E
rychle4                           000000C1
us10                              0000000C
xxx                               0000000D
yyy                               0000000C
zap                               00000017


MEMORY USAGE MAP ('X' = Used,  '-' = Unused)

0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
0080 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
00C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXX------------- ----------------

All other memory blocks unused.

Program Memory Words Used:   224
Program Memory Words Free:   800


Errors   :     0
Warnings :     0 reported,     0 suppressed
Messages :     0 reported,     0 suppressed