Go to most recent revision | Blame | Last modification | View Log | Download
MPASM 02.80 Released OVLAD.ASM 7-21-2002 12:49:43 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 OVLAD.ASM 7-21-2002 12:49:43 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 OVLAD.ASM 7-21-2002 12:49:43 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0000 2817 00005 goto Start
00006 ;--------------------
0004 00007 org 4
00008 ;--------------------
0004 2817 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 OVLAD.ASM 7-21-2002 12:49:43 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 Start:
00014 page1
0017 1683 M bsf STATUS,_RP0
0018 3000 00015 movlw 00000000B ; inicializace citace a prescaleru
0019 0081 00016 movwf TMR0
001A 3000 00017 movlw 00000000B ; konfigurace preruseni
001B 008B 00018 movwf INTCON
00019
00020 page1
001C 1683 M bsf STATUS,_RP0
001D 3000 00021 movlw 00000000B ; nastaveni portu na vstup nebo vystup
001E 0085 00022 movwf PORTA ; 1=vstup 0=vystup
001F 3043 00023 movlw 01000011B
0020 0086 00024 movwf PORTB
00025
0021 1781 00026 bsf TMR0, 7 ; vypni pull-up na PORTB (OPTION registr)
00027
00028 page0
0022 1283 M bcf STATUS,_RP0
00029
0023 0103 00030 clrw ; vynulovani portu
0024 0085 00031 movwf PORTA
0025 0086 00032 movwf PORTB
00033
00034
0026 00035 MainLoop:
0026 30FF 00036 movlw 255
0027 008E 00037 movwf CT1
0028 30FC 00038 movlw 252
0029 008F 00039 movwf CT2
002A 00040 rozj:
00041
002A 038E 00042 decf CT1, f
00043
002B 1405 00044 bsf PORTA, 0
002C 1085 00045 bcf PORTA, 1 ;100
002D 1105 00046 bcf PORTA, 2
002E 2046 00047 call zap
00048
002F 1405 00049 bsf PORTA, 0 ;110
0030 1485 00050 bsf PORTA, 1
MPASM 02.80 Released OVLAD.ASM 7-21-2002 12:49:43 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0031 1105 00051 bcf PORTA, 2
0032 2046 00052 call zap
00053
0033 1005 00054 bcf PORTA, 0 ;010
0034 1485 00055 bsf PORTA, 1
0035 1105 00056 bcf PORTA, 2
0036 2046 00057 call zap
00058
0037 0B8F 00059 decfsz CT2, f
0038 283A 00060 goto ble
0039 2849 00061 goto rychle
00062
003A 1005 00063 ble: bcf PORTA, 0 ;011
003B 1485 00064 bsf PORTA, 1
003C 1505 00065 bsf PORTA, 2
003D 2046 00066 call zap
00067
003E 1005 00068 bcf PORTA, 0 ;001
003F 1085 00069 bcf PORTA, 1
0040 1505 00070 bsf PORTA, 2
0041 2046 00071 call zap
00072
0042 1405 00073 bsf PORTA, 0 ;101
0043 1085 00074 bcf PORTA, 1
0044 1505 00075 bsf PORTA, 2
0045 2046 00076 call zap
00077
0046 00078 zap:
0046 080E 00079 movf CT1, w
0047 008D 00080 movwf xxx ;xxx promena z delay.asm
0048 2005 00081 call Delay1ms
00082
00083 ;----------------------------------------------------
0049 00084 rychle:
0049 1405 00085 bsf PORTA, 0
004A 1085 00086 bcf PORTA, 1 ;100
004B 1105 00087 bcf PORTA, 2
00088 Delay 3
004C 3003 M movlw 3
004D 008D M movwf xxx
004E 2005 M call Delay1ms
00089
00090 ; bsf PORTA, 0 ;110
00091 ; bsf PORTA, 1
00092 ; bcf PORTA, 2
00093 ; Delay
00094
004F 1005 00095 bcf PORTA, 0 ;010
0050 1485 00096 bsf PORTA, 1
0051 1105 00097 bcf PORTA, 2
00098 Delay 3
0052 3003 M movlw 3
0053 008D M movwf xxx
MPASM 02.80 Released OVLAD.ASM 7-21-2002 12:49:43 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0054 2005 M call Delay1ms
00099
00100 ; bcf PORTA, 0 ;011
00101 ; bsf PORTA, 1
00102 ; bsf PORTA, 2
00103 ; Delay 2
00104
0055 1005 00105 bcf PORTA, 0 ;001
0056 1085 00106 bcf PORTA, 1
0057 1505 00107 bsf PORTA, 2
00108 Delay 3
0058 3003 M movlw 3
0059 008D M movwf xxx
005A 2005 M call Delay1ms
00109
00110 ; bsf PORTA, 0 ;101
00111 ; bcf PORTA, 1
00112 ; bsf PORTA, 2
00113 ; Delay 2
005B 2849 00114 goto rychle
00115 ;______________________________________________________________
00116
005C 1105 00117 bcf PORTA, 2
005D 1085 00118 bcf PORTA, 1
00119
005E 00120 smycka:
005E 1C06 00121 btfss PORTB, 0
005F 2861 00122 goto LEDon
0060 285E 00123 goto smycka
0061 00124 LEDon:
0061 1585 00125 bsf PORTA, 3 ;Rozsvit LED
00126 Delay 250
0062 30FA M movlw 250
0063 008D M movwf xxx
0064 2005 M call Delay1ms
0065 1185 00127 bcf PORTA, 3 ;Zhasni LED
00128 Delay 250
0066 30FA M movlw 250
0067 008D M movwf xxx
0068 2005 M call Delay1ms
0069 285E 00129 goto smycka
00130 ;---------------
00131
00132
00133
00134
00135
00136 ;----------------------------
00137 ; Definice promenych
00138 ;----------------------------
00139
00140 cblock
00141
MPASM 02.80 Released OVLAD.ASM 7-21-2002 12:49:43 PAGE 7
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0000000E 00142 CT1
0000000F 00143 CT2
00144
00145 endc
00146
00147 end
MPASM 02.80 Released OVLAD.ASM 7-21-2002 12:49:43 PAGE 8
SYMBOL TABLE
LABEL VALUE
CMP
CT1 0000000E
CT2 0000000F
Delay
Delay01
Delay1ms 00000005
EEADR_0 00000009
EECON1_1 00000008
EECON2_1 00000009
EEDATA_0 00000008
FSR 00000004
IND0 00000000
INTCON 0000000B
LEDon 00000061
MainLoop 00000026
PCL 00000002
PCLATH 0000000A
PORTA 00000005
PORTB 00000006
SB
SC
SN
SNB
SNC
SNZ
SP
STATUS 00000003
SZ
Start 00000017
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
_ZERO 00000002
__16C84__ 00000000
__16F84 00000001
MPASM 02.80 Released OVLAD.ASM 7-21-2002 12:49:43 PAGE 9
SYMBOL TABLE
LABEL VALUE
ble 0000003A
page0
page1
rozj 0000002A
rychle 00000049
smycka 0000005E
us10 0000000C
xxx 0000000D
yyy 0000000C
zap 00000046
MEMORY USAGE MAP ('X' = Used, '-' = Unused)
0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX------ ----------------
All other memory blocks unused.
Program Memory Words Used: 103
Program Memory Words Free: 921
Errors : 0
Warnings : 0 reported, 0 suppressed
Messages : 0 reported, 0 suppressed