Blame | Last modification | View Log | Download
MPASM 02.80 Released BUDIC.ASM 7-22-2002 17:00:57 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 BUDIC.ASM 7-22-2002 17:00:57 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 BUDIC.ASM 7-22-2002 17:00:57 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 BUDIC.ASM 7-22-2002 17:00:57 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 ; movlw 50 ; Otacky
00044 ; movwf CT2
00045 ; movlw 45 ; Pocet kroku zrychleni
00046 ; movwf CT1
00047 ;rozj2:
00048 ; decf CT2, f
00049
00050
MPASM 02.80 Released BUDIC.ASM 7-22-2002 17:00:57 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
002A 30FA 00051 movlw 250 ; Pocet otacek jednoho kroku zrychleni
002B 0090 00052 movwf CT3
00053
002C 3096 00054 movlw 150
002D 0091 00055 movwf CT4
00056
002E 30C8 00057 movlw 200
002F 0092 00058 movwf CT5
00059
0030 30FA 00060 movlw 250
0031 0092 00061 movwf CT5
00062
0032 00063 rozj: ; Rozjezd
0032 1405 00064 bsf PORTA, 0
0033 1085 00065 bcf PORTA, 1 ;100
0034 1105 00066 bcf PORTA, 2
00067 Delay 5
0035 3005 M movlw 5
0036 008D M movwf xxx
0037 2005 M call Delay1ms
00068
00069 ; call zap
00070
0038 1405 00071 bsf PORTA, 0 ;110
0039 1485 00072 bsf PORTA, 1
003A 1105 00073 bcf PORTA, 2
00074 Delay 5
003B 3005 M movlw 5
003C 008D M movwf xxx
003D 2005 M call Delay1ms
00075
003E 1005 00076 bcf PORTA, 0 ;010
003F 1485 00077 bsf PORTA, 1
0040 1105 00078 bcf PORTA, 2
00079 Delay 4
0041 3004 M movlw 4
0042 008D M movwf xxx
0043 2005 M call Delay1ms
00080
0044 1005 00081 bcf PORTA, 0 ;011
0045 1485 00082 bsf PORTA, 1
0046 1505 00083 bsf PORTA, 2
00084 Delay 4
0047 3004 M movlw 4
0048 008D M movwf xxx
0049 2005 M call Delay1ms
00085
004A 1005 00086 bcf PORTA, 0 ;001
004B 1085 00087 bcf PORTA, 1
004C 1505 00088 bsf PORTA, 2
00089 Delay 3
004D 3003 M movlw 3
004E 008D M movwf xxx
MPASM 02.80 Released BUDIC.ASM 7-22-2002 17:00:57 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
004F 2005 M call Delay1ms
00090
0050 1405 00091 bsf PORTA, 0 ;101
0051 1085 00092 bcf PORTA, 1
0052 1505 00093 bsf PORTA, 2
00094 Delay 3
0053 3003 M movlw 3
0054 008D M movwf xxx
0055 2005 M call Delay1ms
00095
0056 0B90 00096 decfsz CT3, f
0057 2832 00097 goto rozj
00098
00099 ; decfsz CT1, f
00100 ; goto rozj2
00101 ; goto rozj
00102
0058 00103 rychle:
0058 1405 00104 bsf PORTA, 0
0059 1085 00105 bcf PORTA, 1 ;100
005A 1105 00106 bcf PORTA, 2
00107 Delay 2
005B 3002 M movlw 2
005C 008D M movwf xxx
005D 2005 M call Delay1ms
00108
005E 3000 00109 movlw 0
005F 0085 00110 movwf PORTA
00111 Delay 3
0060 3003 M movlw 3
0061 008D M movwf xxx
0062 2005 M call Delay1ms
00112
0063 1005 00113 bcf PORTA, 0 ;010
0064 1485 00114 bsf PORTA, 1
0065 1105 00115 bcf PORTA, 2
00116 Delay 2
0066 3002 M movlw 2
0067 008D M movwf xxx
0068 2005 M call Delay1ms
00117
0069 3000 00118 movlw 0
006A 0085 00119 movwf PORTA
00120 Delay 3
006B 3003 M movlw 3
006C 008D M movwf xxx
006D 2005 M call Delay1ms
00121
006E 1005 00122 bcf PORTA, 0 ;001
006F 1085 00123 bcf PORTA, 1
0070 1505 00124 bsf PORTA, 2
00125 Delay 2
0071 3002 M movlw 2
MPASM 02.80 Released BUDIC.ASM 7-22-2002 17:00:57 PAGE 7
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0072 008D M movwf xxx
0073 2005 M call Delay1ms
00126
0074 3000 00127 movlw 0
0075 0085 00128 movwf PORTA
00129 Delay 3
0076 3003 M movlw 3
0077 008D M movwf xxx
0078 2005 M call Delay1ms
00130
0079 0B91 00131 decfsz CT4, f
007A 2858 00132 goto rychle
00133
007B 00134 rychle2:
00135
007B 1405 00136 bsf PORTA, 0
007C 1085 00137 bcf PORTA, 1 ;100
007D 1105 00138 bcf PORTA, 2
00139 Delay 1
007E 3001 M movlw 1
007F 008D M movwf xxx
0080 2005 M call Delay1ms
00140
0081 3000 00141 movlw 0
0082 0085 00142 movwf PORTA
00143 Delay 3
0083 3003 M movlw 3
0084 008D M movwf xxx
0085 2005 M call Delay1ms
00144
0086 1005 00145 bcf PORTA, 0 ;010
0087 1485 00146 bsf PORTA, 1
0088 1105 00147 bcf PORTA, 2
00148 Delay 1
0089 3001 M movlw 1
008A 008D M movwf xxx
008B 2005 M call Delay1ms
00149
008C 3000 00150 movlw 0
008D 0085 00151 movwf PORTA
00152 Delay 3
008E 3003 M movlw 3
008F 008D M movwf xxx
0090 2005 M call Delay1ms
00153
0091 1005 00154 bcf PORTA, 0 ;001
0092 1085 00155 bcf PORTA, 1
0093 1505 00156 bsf PORTA, 2
00157 Delay 1
0094 3001 M movlw 1
0095 008D M movwf xxx
0096 2005 M call Delay1ms
00158
MPASM 02.80 Released BUDIC.ASM 7-22-2002 17:00:57 PAGE 8
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0097 3000 00159 movlw 0
0098 0085 00160 movwf PORTA
00161 Delay 3
0099 3003 M movlw 3
009A 008D M movwf xxx
009B 2005 M call Delay1ms
009C 0B92 00162 decfsz CT5, f
009D 287B 00163 goto rychle2
00164
009E 00165 rychle3:
009E 1405 00166 bsf PORTA, 0
009F 1085 00167 bcf PORTA, 1 ;100
00A0 1105 00168 bcf PORTA, 2
00169 Delay 1
00A1 3001 M movlw 1
00A2 008D M movwf xxx
00A3 2005 M call Delay1ms
00170
00A4 3000 00171 movlw 0
00A5 0085 00172 movwf PORTA
00173 Delay 2
00A6 3002 M movlw 2
00A7 008D M movwf xxx
00A8 2005 M call Delay1ms
00174
00A9 1005 00175 bcf PORTA, 0 ;010
00AA 1485 00176 bsf PORTA, 1
00AB 1105 00177 bcf PORTA, 2
00178 Delay 1
00AC 3001 M movlw 1
00AD 008D M movwf xxx
00AE 2005 M call Delay1ms
00179
00AF 3000 00180 movlw 0
00B0 0085 00181 movwf PORTA
00182 Delay 2
00B1 3002 M movlw 2
00B2 008D M movwf xxx
00B3 2005 M call Delay1ms
00183
00B4 1005 00184 bcf PORTA, 0 ;001
00B5 1085 00185 bcf PORTA, 1
00B6 1505 00186 bsf PORTA, 2
00187 Delay 1
00B7 3001 M movlw 1
00B8 008D M movwf xxx
00B9 2005 M call Delay1ms
00188
00BA 3000 00189 movlw 0
00BB 0085 00190 movwf PORTA
00191 Delay 2
00BC 3002 M movlw 2
00BD 008D M movwf xxx
MPASM 02.80 Released BUDIC.ASM 7-22-2002 17:00:57 PAGE 9
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00BE 2005 M call Delay1ms
00192 ; decfsz CT3, f
00BF 289E 00193 goto rychle3
00194
00195 ;rychle4:
00196 ; bsf PORTA, 0
00197 ; bcf PORTA, 1 ;100
00198 ; bcf PORTA, 2
00199 ; Delay 1
00200 ;
00201 ; movlw 0
00202 ; movwf PORTA
00203 ; Delay 1
00204 ;
00205 ; bcf PORTA, 0 ;010
00206 ; bsf PORTA, 1
00207 ; bcf PORTA, 2
00208 ; Delay 1
00209 ;
00210 ; movlw 0
00211 ; movwf PORTA
00212 ; Delay 1
00213 ;
00214 ; bcf PORTA, 0 ;001
00215 ; bcf PORTA, 1
00216 ; bsf PORTA, 2
00217 ; Delay 1
00218 ;
00219 ; movlw 0
00220 ; movwf PORTA
00221 ; Delay 1
00222 ;
00223 ; goto rychle4
00224
00225 ;______________________________________________________________
00226
00227 ;----------------------------
00228 ; Definice promenych
00229 ;----------------------------
00230
00231 cblock
00232
0000000E 00233 CT1
0000000F 00234 CT2
00000010 00235 CT3
00000011 00236 CT4
00000012 00237 CT5
00000013 00238 CT6
00239 endc
00240
00241 end
MPASM 02.80 Released BUDIC.ASM 7-22-2002 17:00:57 PAGE 10
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 BUDIC.ASM 7-22-2002 17:00:57 PAGE 11
SYMBOL TABLE
LABEL VALUE
_ZERO 00000002
__16C84__ 00000000
__16F84 00000001
page0
page1
rozj 00000032
rychle 00000058
rychle2 0000007B
rychle3 0000009E
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
All other memory blocks unused.
Program Memory Words Used: 189
Program Memory Words Free: 835
Errors : 0
Warnings : 0 reported, 0 suppressed
Messages : 0 reported, 0 suppressed