Go to most recent revision | Blame | Last modification | View Log | Download
MPASM 02.80 Released OVLAD.ASM 7-12-2002 20:18:51 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-12-2002 20:18:51 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-12-2002 20:18:51 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0000 281A 00005 goto Start
00006 ;--------------------
0004 00007 org 4
00008 ;--------------------
0004 281A 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 ;--- Spozdeni v nasobcich 1.002ms ----
0005 00009 Jednou:
0005 0000 00010 nop
0006 00011 Delay1ms:
0006 3063 00012 movlw 99 ; 1 ms
0007 008C 00013 movwf yyy ; goto 2 takty decfsz 1 kdyz 1 jinak 2
0008 200C 00014 call us10
00015
0009 0B8D 00016 decfsz xxx, f
000A 2805 00017 goto Jednou
00018 ;---------------------------------
000B 0008 00019 return ;2us
00020
00021 ;--- Spozdeni v nasobcich 10us ----
000C 00022 us10: ; Prodleva (yyy * 10us)+3us
00023
000C 0000 00024 nop
000D 0000 00025 nop
000E 0000 00026 nop
000F 0000 00027 nop
0010 0000 00028 nop
0011 0000 00029 nop
0012 0B8C 00030 decfsz yyy, f
0013 280C 00031 goto us10
0014 0000 00032 nop
0015 0000 00033 nop
0016 0000 00034 nop
0017 0000 00035 nop
0018 0000 00036 nop
0019 0008 00037 return
00038 ;-------------------------
00039
00040 ;----------------------------
00041 ; Definice promenych
00042 ;----------------------------
00043
00044 cblock
00045
0000000C 00046 yyy
MPASM 02.80 Released OVLAD.ASM 7-12-2002 20:18:51 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0000000D 00047 xxx
00048
00049 endc
00050
00012
001A 00013 Start:
00014 page1
001A 1683 M bsf STATUS,_RP0
001B 3000 00015 movlw 00000000B ; inicializace citace a prescaleru
001C 0081 00016 movwf TMR0
001D 3000 00017 movlw 00000000B ; konfigurace preruseni
001E 008B 00018 movwf INTCON
00019
00020 page1
001F 1683 M bsf STATUS,_RP0
0020 3000 00021 movlw 00000000B ; nastaveni portu na vstup nebo vystup
0021 0085 00022 movwf PORTA ; 1=vstup 0=vystup
0022 3043 00023 movlw 01000011B
0023 0086 00024 movwf PORTB
00025
0024 1781 00026 bsf TMR0, 7 ; vypni pull-up na PORTB (OPTION registr)
00027
00028 page0
0025 1283 M bcf STATUS,_RP0
00029
0026 0103 00030 clrw ; vynulovani portu
0027 0085 00031 movwf PORTA
0028 0086 00032 movwf PORTB
00033
0029 00034 MainLoop:
0029 1586 00035 bsf PORTB, 3 ; Pridrz napajeni
002A 1606 00036 bsf PORTB, 4
002B 1585 00037 bsf PORTA, 3 ;Rozsvit LED
00038
00039 Delay 250
002C 30FA M movlw 250
002D 008D M movwf xxx
002E 2006 M call Delay1ms
00040
002F 1185 00041 bcf PORTA, 3 ;Zhasni LED
00042
00043 Delay 250
0030 30FA M movlw 250
0031 008D M movwf xxx
0032 2006 M call Delay1ms
00044
00045
0033 1105 00046 bcf PORTA, 2
0034 1085 00047 bcf PORTA, 1
0035 00048 smycka:
0035 1C06 00049 btfss PORTB, 0
0036 2838 00050 goto LEDon
0037 2835 00051 goto smycka
MPASM 02.80 Released OVLAD.ASM 7-12-2002 20:18:51 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0038 00052 LEDon:
0038 1585 00053 bsf PORTA, 3 ;Rozsvit LED
00054 Delay 250
0039 30FA M movlw 250
003A 008D M movwf xxx
003B 2006 M call Delay1ms
003C 1185 00055 bcf PORTA, 3 ;Zhasni LED
00056 Delay 250
003D 30FA M movlw 250
003E 008D M movwf xxx
003F 2006 M call Delay1ms
0040 2835 00057 goto smycka
00058 ;---------------
00059
00060
00061
00062
00063
00064 ;----------------------------
00065 ; Definice promenych
00066 ;----------------------------
00067
00068 cblock
00069
0000000E 00070 CT1
0000000F 00071 CT2
00072
00073 endc
00074
00075 end
MPASM 02.80 Released OVLAD.ASM 7-12-2002 20:18:51 PAGE 6
SYMBOL TABLE
LABEL VALUE
CMP
CT1 0000000E
CT2 0000000F
Delay
Delay1ms 00000006
EEADR_0 00000009
EECON1_1 00000008
EECON2_1 00000009
EEDATA_0 00000008
FSR 00000004
IND0 00000000
INTCON 0000000B
Jednou 00000005
LEDon 00000038
MainLoop 00000029
PCL 00000002
PCLATH 0000000A
PORTA 00000005
PORTB 00000006
SB
SC
SN
SNB
SNC
SNZ
SP
STATUS 00000003
SZ
Start 0000001A
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-12-2002 20:18:51 PAGE 7
SYMBOL TABLE
LABEL VALUE
page0
page1
smycka 00000035
us10 0000000C
xxx 0000000D
yyy 0000000C
MEMORY USAGE MAP ('X' = Used, '-' = Unused)
0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
0040 : X--------------- ---------------- ---------------- ----------------
All other memory blocks unused.
Program Memory Words Used: 62
Program Memory Words Free: 962
Errors : 0
Warnings : 0 reported, 0 suppressed
Messages : 0 reported, 0 suppressed