Blame | Last modification | View Log | Download
MPASM 01.02 Released SERVO.ASM 8-21-1999 18:28:26 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0001 #include 16C84.INC
0001 ;
0002 ; Definice registru a zakladnich maker pro 16C84
0003 ;
0004 processor 16C84
0005 radix D
0006
0000 0007 __16C84__: ; Priznak modulu 16C84
0008
0009 ; Definice registru
0010
0000 0011 IND0 equ 00H ; 0&1 Pristup na neprimou adresu
0001 0012 TMR0 equ 01H ; 0 Real Time clock counter
0002 0013 PCL equ 02H ; 0&1 Spodni cast PC
0003 0014 STATUS equ 03H ; 0&1 Stavove bity
0000 0015 _CARRY equ 0
0001 0016 _DC equ 1
0002 0017 _ZERO equ 2
0003 0018 _PD equ 3
0004 0019 _TO equ 4
0005 0020 _RP0 equ 5
0006 0021 _RP1 equ 6
0007 0022 _IRP equ 7
0004 0023 FSR equ 04H ; 0&1 Ukazatel pro neprime adresovani
0005 0024 PORTA equ 05H ; 0&1 Data a rizeni portu A
0006 0025 PORTB equ 06H ; 0&1 Data a rizeni portu B
0008 0026 EEDATA_0 equ 08H ; 0 Data EEPROM
0008 0027 EECON1_1 equ 08H ; 1 Rizeni EEPROM
0000 0028 _EERD equ 0
0001 0029 _EEWR equ 1
0002 0030 _EEWREN equ 2
0003 0031 _EEWRERR equ 3
0004 0032 _EEIF equ 4
0009 0033 EEADR_0 equ 09H ; 0 Adresa EEPROM
0009 0034 EECON2_1 equ 09H ; 1 Aktivacni pseudoregistr
000A 0035 PCLATH equ 0AH ; 0&1 Horni cast PC pro move
000B 0036 INTCON equ 0BH ; 0&1 Rizeni preruseni
0000 0037 _RBIF equ 0 ;
0001 0038 _INTF equ 1
0002 0039 _T0IF equ 2
0003 0040 _RBIE equ 3
0004 0041 _INTE equ 4
0005 0042 _T0IE equ 5
0006 0043 _EEIE equ 6
0007 0044 _GIE equ 7
0045
0046 page0 macro
0047 bcf STATUS,_RP0
0048 endm
0049
0050 page1 macro
0051 bsf STATUS,_RP0
0052 endm
MPASM 01.02 Released SERVO.ASM 8-21-1999 18:28:26 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0053 ;
0054 ; Sada maker pro porovnani a skoky
0055 ;
0056
0057 ;--- Compare ---
0058 CMP macro ZNAK, PROCEDURA ; if W=ZNAK then goto PROCEDURA
0059 xorlw ZNAK ; if W#ZNAK then zachovej W a neskakej
0060 btfsc STATUS,_ZERO
0061 goto PROCEDURA
0062 xorlw ZNAK
0063 endm
0064
0065 ;--- Skip if Carry ---
0066 SC macro
0067 btfss STATUS,_CARRY
0068 endm
0069
0070 ;--- Skip if not Carry ---
0071 SNC macro
0072 btfsc STATUS,_CARRY
0073 endm
0074
0075 ;--- Skip if Zero ---
0076 SZ macro
0077 btfss STATUS,_ZERO
0078 endm
0079
0080 ;--- Skip if not Zero ---
0081 SNZ macro
0082 btfsc STATUS,_ZERO
0083 endm
0084
0085 ;--- Skip if Borrow ( Negative ) --- ( po odecitani )
0086 SB macro
0087 btsfsc STATUS,_CARRY
0088 endm
0089 SN macro
0090 btfsc STATUS,_CARRY
0091 endm
0092
0093 ;--- Skip if not Borrow ( Positive ) --- ( po odecitani )
0094 SNB macro
0095 btfss STATUS,_CARRY
0096 endm
0097 SP macro
0098 btfss STATUS,_CARRY
0099 endm
0100
0101 cblock 0CH ; Prvni volny registr
0102 endc
0001
0002
0003 org 0
MPASM 01.02 Released SERVO.ASM 8-21-1999 18:28:26 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0004
0000 2804 0005 goto Start
0006 ;--------------------
0007 org 4
0008 ;--------------------
0009
0004 0010 Start:
0011 page1
0004 1683 M bsf STATUS,_RP0
0005 3000 0012 movlw 00000000B ; inicializace citace a prescaleru
0006 0081 0013 movwf TMR0
0007 3000 0014 movlw 00000000B ; konfigurace preruseni
0008 008B 0015 movwf INTCON
0016
0017 page1
0009 1683 M bsf STATUS,_RP0
000A 30F7 0018 movlw 11110111B ; nastaveni portu na vstup nebo vystup
000B 0085 0019 movwf PORTA ; 1=vstup 0=vystup
000C 30F1 0020 movlw 11110001B
000D 0086 0021 movwf PORTB
0022
000E 1781 0023 bsf TMR0, 7 ; vypni pull-up na PORTB (OPTION registr)
0024
0025 page0
000F 1283 M bcf STATUS,_RP0
0026
0010 0100 0027 clrw ; vynulovani portu
0011 0085 0028 movwf PORTA
0012 0086 0029 movwf PORTB
0030
0013 1585 0031 bsf PORTA, 3 ; Pull-Up na tlacitka
0032
0014 1086 0033 bcf PORTB, 1 ; zhasnuti LED
0015 1106 0034 bcf PORTB, 2
0016 1186 0035 bcf PORTB, 3
0036
0017 0037 MainLoop:
0038 ;prodleva 10ms
0039
0017 30FA 0040 movlw 250 ; 2,5 ms
0018 008C 0041 movwf CT10
0019 2033 0042 call Delay10us
001A 30FA 0043 movlw 250 ; 2,5 ms
001B 008C 0044 movwf CT10
001C 2033 0045 call Delay10us
001D 30FA 0046 movlw 250 ; 2,5 ms
001E 008C 0047 movwf CT10
001F 2033 0048 call Delay10us
0020 30FA 0049 movlw 250 ; 2,5 ms
0021 008C 0050 movwf CT10
MPASM 01.02 Released SERVO.ASM 8-21-1999 18:28:26 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0022 2033 0051 call Delay10us
0052
0023 1486 0053 bsf PORTB, 1 ; ON
0054
0024 3096 0055 movlw 150
0056
0025 1C85 0057 btfss PORTA, 1 ; Test TL1
0026 3064 0058 movlw 100
0059
0027 1F06 0060 btfss PORTB, 6 ; Test TL2
0028 30C8 0061 movlw 200
0062
0029 008C 0063 movwf CT10
002A 2033 0064 call Delay10us
0065
002B 1086 0066 bcf PORTB, 1 ; OFF
0067
0068
002C 1106 0069 bcf PORTB, 2 ; zhasnuti LED
002D 1186 0070 bcf PORTB, 3
0071
002E 1C85 0072 btfss PORTA, 1 ; Test TL1
002F 1506 0073 bsf PORTB, 2 ; rozsviceni LED2
0074
0030 1F06 0075 btfss PORTB, 6 ; Test TL2
0031 1586 0076 bsf PORTB, 3 ; rozsviceni LED2
0077
0032 2817 0078 goto MainLoop
0079 ;---------------
0080
0033 0081 Delay10us: ; Prodleva (DELAY10 * 10us)+3us
0033 0000 0082 nop
0034 0000 0083 nop
0035 0000 0084 nop
0036 0000 0085 nop
0037 0000 0086 nop
0038 0000 0087 nop
0039 0000 0088 nop
003A 0B8C 0089 decfsz CT10, 1
003B 2833 0090 goto Delay10us
003C 0008 0091 return
0092
0093 #include SERVO.INC
0001 ;----------------------------
0002 ; Definice promenych
0003 ;----------------------------
0004
0005 cblock
000C 0006
000C 0007 CT10
000D 0008
0009 endc
0093
MPASM 01.02 Released SERVO.ASM 8-21-1999 18:28:26 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0094
0095 end
0096
MPASM 01.02 Released SERVO.ASM 8-21-1999 18:28:26 PAGE 6
SYMBOL TABLE
LABEL VALUE
CT10 000C
Delay10us 0033
EEADR_0 0009
EECON1_1 0008
EECON2_1 0009
EEDATA_0 0008
FSR 0004
IND0 0000
INTCON 000B
MainLoop 0017
PCL 0002
PCLATH 000A
PORTA 0005
PORTB 0006
STATUS 0003
Start 0004
TMR0 0001
_CARRY 0000
_DC 0001
_EEIE 0006
_EEIF 0004
_EERD 0000
_EEWR 0001
_EEWREN 0002
_EEWRERR 0003
_GIE 0007
_INTE 0004
_INTF 0001
_IRP 0007
_PD 0003
_RBIE 0003
_RBIF 0000
_RP0 0005
_RP1 0006
_T0IE 0005
_T0IF 0002
_TO 0004
_ZERO 0002
__16C84__ 0000
MEMORY USAGE MAP ('X' = Used, '-' = Unused)
0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX---
0040 : ---------------- ---------------- ---------------- ----------------
All other memory blocks unused.
Errors : 0
Warnings : 0
Messages : 0