?? timer.lst
字號(hào):
MPASM 02.61 Released TIMER.ASM 3-26-2001 22:06:32 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 ; TIMER.ASM
00002 ; *********
00003 ; [ milindhp@tifrvax.tifr.res.in ]
00004 ;Set Processor configuration word as = 0000 0000 1010 b.
00005 ; a] -MCLR tied to VDD (internally).
00006 ; b] Code protection off.
00007 ; c] WDT disabled.
00008 ; d] Internal RC oscillator [4 MHZ].
00009
Warning[205]: Found directive in column 1. (list)
00010 list p=12c508, r=dec
Warning[205]: Found directive in column 1. (include)
00011 include "p12c508.inc"
00001 LIST
00002 ; P12C508.INC Standard Header File, Version 1.02 Microchip Technology, Inc.
00105 LIST
00012 ;define ram
Warning[205]: Found directive in column 1. (include)
00013 include "def_ram.asm"
00001 ; define ram ports and data
00002 ;DEFINE PORT
00003 ; ***********
00004 ;DEFINE PORTS
00005 ;************
00000000 00006 gp0 equ 0
00000001 00007 gp1 equ 1
00000002 00008 gp2 equ 2
00000003 00009 gp3 equ 3
00000004 00010 gp4 equ 4
00000005 00011 gp5 equ 5
00012 ;DISPLAY PORT
00013 ;************
00000000 00014 disp_data equ gp0
00000001 00015 disp_clk equ gp1
00000002 00016 disp_strobe equ gp2
00017 ;KEYBOARD PORT
00018 ;*************
00019 ;units_key equ gp3
00020 ;tens_key equ gp4
00021 ;RELAY PORT
00022 ;**********
00000005 00023 relay equ gp5
00024 ;*******************************************************
00025 ;DEFINE RAM
00000008 00026 units equ 08h ;minutes unit display
00000009 00027 tens equ units+1 ;minutes tens display
0000000A 00028 counter_4ms equ tens+1 ;incremented every 4 msec
0000000B 00029 counter_100ms equ counter_4ms+1 ;incremented every 100 msec
0000000C 00030 seconds equ counter_100ms+1
0000000D 00031 oldkey equ seconds+1 ;for key debouncing
0000000E 00032 newkey equ oldkey+1 ;-------- ,, ------
0000000F 00033 key equ newkey+1 ;key pressed data
00000010 00034 digit_inc equ key+1 ;inc units display if bo = 1
MPASM 02.61 Released TIMER.ASM 3-26-2001 22:06:32 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00035 ;inc tens display if b1 = 1
00000011 00036 tmr_comp equ digit_inc+1 ;tmr0 comparator register
00000012 00037 scrtch0 equ tmr_comp+1
00000013 00038 scrtch1 equ scrtch0+1
00000014 00039 scrtch2 equ scrtch1+1
00040 ;*******************************************************
00041 ;DEFINE FLAGS AND BITS
00000000 00042 b0 equ 0
00000001 00043 b1 equ 1
00000002 00044 b2 equ 2
00000003 00045 b3 equ 3
00000004 00046 b4 equ 4
00000005 00047 b5 equ 5
00000006 00048 b6 equ 6
00000007 00049 b7 equ 7
00050 ;key
00051 ;***
00052 ; equ b0
00053 ; equ b1
00054 ; equ b2
00000003 00055 units_key equ b3
00000004 00056 tens_key equ b4
00057 ; equ b5
00058 ; equ b6
00059 ; equ b7
00060 ;digit_inc
00061 ;*********
00000000 00062 units_inc equ b0
00000001 00063 tens_inc equ b1
00064 ; equ b2
00065 ; equ b3
00066 ; equ b4
00067 ; equ b5
00068 ; equ b6
00069 ; equ b7
00070 ;******************************************
00071 #define data_hi bsf GPIO, disp_data
00072 #define data_lo bcf GPIO, disp_data
00073 #define clk_hi bsf GPIO, disp_clk
00074 #define clk_lo bcf GPIO, disp_clk
00075 #define strobe_hi bsf GPIO, disp_strobe
00076 #define strobe_lo bcf GPIO, disp_strobe
00077 #define relay_on bsf GPIO, relay
00078 #define relay_off bcf GPIO, relay
00014 ;processor start
Warning[205]: Found directive in column 1. (org)
0000 00015 org 0
Warning[203]: Found opcode in column 1. (goto)
0000 0A21 00016 goto start
00017 ;define legends and table
Warning[205]: Found directive in column 1. (include)
00018 include "tables.asm"
00001 ; TABLES.ASM
MPASM 02.61 Released TIMER.ASM 3-26-2001 22:06:32 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00002 ; **********
00003 ;7 segments decoded data. lo is segment on & hi is segment off
0001 01E2 00004 get_seg addwf PCL, f
00005 ; ABCDEFGP ;P is decimal point
Warning[203]: Found opcode in column 1. (retlw)
0002 0803 00006 retlw 00000011b ;0
Warning[203]: Found opcode in column 1. (retlw)
0003 089F 00007 retlw 10011111b ;1
Warning[203]: Found opcode in column 1. (retlw)
0004 0825 00008 retlw 00100101b ;2
Warning[203]: Found opcode in column 1. (retlw)
0005 080D 00009 retlw 00001101b ;3
Warning[203]: Found opcode in column 1. (retlw)
0006 0899 00010 retlw 10011001b ;4
Warning[203]: Found opcode in column 1. (retlw)
0007 0849 00011 retlw 01001001b ;5
Warning[203]: Found opcode in column 1. (retlw)
0008 0841 00012 retlw 01000001b ;6
Warning[203]: Found opcode in column 1. (retlw)
0009 081F 00013 retlw 00011111b ;7
Warning[203]: Found opcode in column 1. (retlw)
000A 0801 00014 retlw 00000001b ;8
Warning[203]: Found opcode in column 1. (retlw)
000B 0819 00015 retlw 00011001b ;9
000000FE 00016 dec_pt equ 11111110b ;decimal point bit
00017 ;*************** EOF TABLES.ASM **************************
00019 ;subroutines
Warning[205]: Found directive in column 1. (include)
00020 include "subs.asm"
00001 ; SUBS.ASM
00002 ; ********
00003 ;read key port in key
000C 020E 00004 read_keys movf newkey, w ;debouncing taken care by s/w
Warning[203]: Found opcode in column 1. (movwf)
000D 002D 00005 movwf oldkey
Warning[203]: Found opcode in column 1. (movf)
000E 0206 00006 movf GPIO, w ;read newkeys
Warning[203]: Found opcode in column 1. (andlw)
000F 0E18 00007 andlw 00011000b ;gp3, gp4 are key ports
Warning[203]: Found opcode in column 1. (movwf)
0010 002E 00008 movwf newkey
Warning[203]: Found opcode in column 1. (comf)
0011 026E 00009 comf newkey, f ;complement since active low
Warning[203]: Found opcode in column 1. (andwf)
0012 014D 00010 andwf oldkey, w ;key=oldkey AND compl(newkey)
Warning[203]: Found opcode in column 1. (movwf)
0013 002F 00011 movwf key
00012 ;indicate to display routine units or tens key pressed
Warning[203]: Found opcode in column 1. (btfsc)
0014 066F 00013 btfsc key, units_key
Warning[203]: Found opcode in column 1. (bsf)
0015 0510 00014 bsf digit_inc, units_inc
Warning[203]: Found opcode in column 1. (btfsc)
MPASM 02.61 Released TIMER.ASM 3-26-2001 22:06:32 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0016 068F 00015 btfsc key, tens_key
Warning[203]: Found opcode in column 1. (bsf)
0017 0530 00016 bsf digit_inc, tens_inc
Warning[204]: Found pseudo-op in column 1. (return)
Warning[227]: Substituting RETLW 0 for RETURN pseudo-op
0018 0800 00017 return
00018 ;************************************************************
0019 0C00 00019 init_ports movlw 0 ;all lo
Warning[203]: Found opcode in column 1. (movwf)
001A 0026 00020 movwf GPIO
Warning[203]: Found opcode in column 1. (movlw)
001B 0C18 00021 movlw 00011000b ;port g0-g2,g5 o/p & gp3,gp4 i/p
Warning[203]: Found opcode in column 1. (tris)
001C 0006 00022 tris GPIO
Warning[203]: Found opcode in column 1. (clrf)
001D 0061 00023 clrf TMR0 ;clr tmr0 & prescaler
Warning[203]: Found opcode in column 1. (movlw)
001E 0CC3 00024 movlw 11000011b ;tmr0 enable with 1:16 prescaler
Warning[203]: Found opcode in column 1. (option)
001F 0002 00025 option
Warning[204]: Found pseudo-op in column 1. (return)
Warning[227]: Substituting RETLW 0 for RETURN pseudo-op
0020 0800 00026 return
00027 ;***************** EOF SUBS.ASM ******************************
00021 ;initialize and start
0021 006F 00022 start clrf key
Warning[203]: Found opcode in column 1. (clrf)
0022 006D 00023 clrf oldkey
Warning[203]: Found opcode in column 1. (clrf)
0023 006E 00024 clrf newkey
Warning[203]: Found opcode in column 1. (clrf)
0024 0070 00025 clrf digit_inc
Warning[203]: Found opcode in column 1. (clrf)
0025 0068 00026 clrf units
Warning[203]: Found opcode in column 1. (clrf)
0026 0069 00027 clrf tens
Warning[203]: Found opcode in column 1. (clrf)
0027 006A 00028 clrf counter_4ms
Warning[203]: Found opcode in column 1. (clrf)
0028 006B 00029 clrf counter_100ms
Warning[203]: Found opcode in column 1. (clrf)
0029 006C 00030 clrf seconds
Warning[203]: Found opcode in column 1. (movlw)
002A 0CFA 00031 movlw 250 ;4000us tmr0 (1:16 prescaler * 250 )
Warning[203]: Found opcode in column 1. (movwf)
002B 0031 00032 movwf tmr_comp
Warning[203]: Found opcode in column 1. (call)
002C 0919 00033 call init_ports ;init ports & timer
002D 0211 00034 main movf tmr_comp, w ;is tmr0 = tmr_comp (4 msec over?)
Warning[203]: Found opcode in column 1. (xorwf)
002E 0181 00035 xorwf TMR0, w
Warning[203]: Found opcode in column 1. (btfss)
002F 0743 00036 btfss STATUS, Z ;skip if = 250
MPASM 02.61 Released TIMER.ASM 3-26-2001 22:06:32 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
Warning[203]: Found opcode in column 1. (goto)
0030 0A2D 00037 goto main
Warning[203]: Found opcode in column 1. (movlw)
0031 0CFA 00038 movlw 250
Warning[203]: Found opcode in column 1. (addwf)
0032 01F1 00039 addwf tmr_comp, f ;update 4 msec compare register
Warning[203]: Found opcode in column 1. (incf)
0033 02AA 00040 incf counter_4ms, f
Warning[203]: Found opcode in column 1. (movlw)
0034 0C19 00041 movlw 25
Warning[203]: Found opcode in column 1. (xorwf)
0035 018A 00042 xorwf counter_4ms, w ;is 4ms * 25 = 100ms over ?
Warning[203]: Found opcode in column 1. (btfss)
0036 0743 00043 btfss STATUS, Z ;skip if = 100ms
Warning[203]: Found opcode in column 1. (goto)
0037 0A2D 00044 goto main
Warning[203]: Found opcode in column 1. (clrf)
0038 006A 00045 clrf counter_4ms
00046 ;************** 100 MSEC OVER **********************************
Warning[203]: Found opcode in column 1. (incf)
0039 02AB 00047 incf counter_100ms, f
Warning[203]: Found opcode in column 1. (movlw)
003A 0C0A 00048 movlw 10
Warning[203]: Found opcode in column 1. (xorwf)
003B 018B 00049 xorwf counter_100ms, w ;is 100ms * 10 = 1sec over ?
Warning[203]: Found opcode in column 1. (btfss)
003C 0743 00050 btfss STATUS, Z ;skip if 1 sec over
Warning[203]: Found opcode in column 1. (goto)
003D 0A54 00051 goto main21 ;jmp if 1 sec not over
Warning[203]: Found opcode in column 1. (clrf)
003E 006B 00052 clrf counter_100ms ;1 sec over
Warning[203]: Found opcode in column 1. (incf)
003F 02AC 00053 incf seconds, f
Warning[203]: Found opcode in column 1. (movlw)
0040 0C3C 00054 movlw 60
Warning[203]: Found opcode in column 1. (xorwf)
0041 018C 00055 xorwf seconds, w ;is 1 minute over ?
Warning[203]: Found opcode in column 1. (btfss)
0042 0743 00056 btfss STATUS, Z ;skip if 1 min over
Warning[203]: Found opcode in column 1. (goto)
0043 0A54 00057 goto main21
00058 ;************** 1 MINUTE OVER *********************************
Warning[203]: Found opcode in column 1. (clrf)
0044 006C 00059 clrf seconds
00060 ;process relay and display
00061 ;if tens & units both = 0 then rly off and out
00062 ;else relay on & decrement display & out
Warning[203]: Found opcode in column 1. (movf)
0045 0209 00063 movf tens, w
Warning[203]: Found opcode in column 1. (iorwf)
0046 0108 00064 iorwf units, w
Warning[203]: Found opcode in column 1. (btfss)
0047 0743 00065 btfss STATUS, Z
MPASM 02.61 Released TIMER.ASM 3-26-2001 22:06:32 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
Warning[203]: Found opcode in column 1. (goto)
0048 0A4B 00066 goto main1
Warning[203]: Found opcode in column 1. (bcf)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -