?? iovslcd.asm
字號:
;*********************************************
;FILE NAME: IO_LCD
;MCU: HT46R22
;MASK OPTION: WAKE-UP: PA6,PA7
; PULL-HIGH: PA,PB,PC
; IIC: DISABLE
; PFD: DISABLE
; PWM: DISABLE
; WDT: ENABLE
; CLRWDT: ONE
; WDT CLOCK SOURCE: T1
; WDT TIME OUT SELECT: WDT CLOCK SOURCE/32768
; LVR: DISABLE
; OSC: CRYSTAL
; SYSVOLT: 3.0V
; SYSFRAG: 4000KHZ
;AUTHOR: RADOME
;HISTORY: 2005.08.22
;*********************************************
include Ht46r22.inc
include Micro.inc
;*********************************************
IO_data .section 'data'
;*********************************************
acc_bk db ?
status_bk db ?
pa_bk db ?
pb_bk db ?
pbc_bk db ?
pulse_count db ?
display_temp db ?
display_temp0 db ?
display_temp1 db ?
display_temp2 db ?
number0 db ?
number1 db ?
number2 db ?
msecond db ?
second db ?
minute db ?
;----------------------------------------
segment0 equ pa_bk.0
segment1 equ pa_bk.1
segment2 equ pa_bk.2
segment3 equ pa_bk.3
segment4 equ pb_bk.4
segment5 equ pb_bk.5
com0 equ pb_bk.3
com0_ctrl equ pbc_bk.3
com1 equ pb_bk.6
com1_ctrl equ pbc_bk.6
com2 equ pb_bk.7
com2_ctrl equ pbc_bk.7
;*********************************************
IO_code .section 'code'
;*********************************************
org 0000h
jmp init
org 0004h ;External Interrupt
reti
org 0008h ;Timer Interrupt
jmp timer_int
org 0020h
;*********************************************
;Initializers
;*********************************************
init:
clr intc0
clr intc1
clr tmrc
clr msecond
clr second
clr minute
clr pulse_count
clr display_temp
clr display_temp0
clr display_temp1
clr display_temp2
clr number0
clr number1
clr number2
mov a,11011111b
mov pa,a
mov pa_bk,a
mov a,11010000b
mov pac,a
set pb
set pb_bk
mov a,00000001b
mov pbc,a
mov pbc_bk,a
mov a,00000001b
mov pc,a
clr pcc
clr pd
clr pdc
mov a,00000101b
mov intc0,a
mov a,94
mov tmr,a
mov a,10010110b
mov tmrc,a
;*********************************************
;Main
;*********************************************
main_loop:
clr wdt
mov a,minute
add a,bcd_table
mov tblp,a
tabrdl number2
mov a,number2
and a,0f0h
swap acc
mov number0,a
mov a,number2
and a,0fh
mov number1,a
mov a,number0
mov display_temp0,a
mov a,number1
mov display_temp1,a
mov a,number2
mov display_temp2,a
jmp main_loop
;*********************************************
;Interrupt
;*********************************************
timer_int: ;2592us
push
;----------------------------------------
;COM Operation Mode
;----------------------------------------
com_pulse:
inc pulse_count
mov a,pulse_count
sub a,7
snz c
jmp $+3
mov a,1
mov pulse_count,a
mov a,pulse_count
sdz acc
jmp $+2
jmp com1_out_high
sdz acc
jmp $+2
jmp com1_out_low
sdz acc
jmp $+2
jmp com2_out_high
sdz acc
jmp $+2
jmp com2_out_low
sdz acc
jmp com0_out_low
com0_out_high:
clr com0_ctrl
set com0
set com1_ctrl
set com2_ctrl
jmp segment_pulse
com0_out_low:
clr com0_ctrl
clr com0
set com1_ctrl
set com2_ctrl
jmp segment_pulse
com1_out_high:
set com0_ctrl
clr com1_ctrl
set com1
set com2_ctrl
jmp segment_pulse
com1_out_low:
set com0_ctrl
clr com1_ctrl
clr com1
set com2_ctrl
jmp segment_pulse
com2_out_high:
set com0_ctrl
set com1_ctrl
clr com2_ctrl
set com2
jmp segment_pulse
com2_out_low:
set com0_ctrl
set com1_ctrl
clr com2_ctrl
clr com2
;----------------------------------------
;SEGMENT Operation Mode
;----------------------------------------
segment_pulse:
;------------------------
segment0_out:
mov a,display_temp0
add a,number_table
mov tblp,a
tabrdl display_temp
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
and a,00000111b
inc acc
sdz acc
jmp $+2
jmp segment0_000
sdz acc
jmp $+2
jmp segment0_001
sdz acc
jmp $+2
jmp segment0_010
sdz acc
jmp $+2
jmp segment0_011
sdz acc
jmp $+2
jmp segment0_100
sdz acc
jmp $+2
jmp segment0_101
sdz acc
jmp segment0_111
jmp segment0_110
segment0_000:
mov a,com_000_table
jmp segment0_next
segment0_001:
mov a,com_001_table
jmp segment0_next
segment0_010:
mov a,com_010_table
jmp segment0_next
segment0_011:
mov a,com_011_table
jmp segment0_next
segment0_100:
mov a,com_100_table
jmp segment0_next
segment0_101:
mov a,com_101_table
jmp segment0_next
segment0_110:
mov a,com_110_table
jmp segment0_next
segment0_111:
mov a,com_111_table
segment0_next:
add a,pulse_count
mov tblp,a
tabrdl acc
clr segment0
sz acc
set segment0
;------------------------
segment1_out:
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
and a,00000111b
inc acc
sdz acc
jmp $+2
jmp segment1_000
sdz acc
jmp $+2
jmp segment1_001
sdz acc
jmp $+2
jmp segment1_010
sdz acc
jmp $+2
jmp segment1_011
sdz acc
jmp $+2
jmp segment1_100
sdz acc
jmp $+2
jmp segment1_101
sdz acc
jmp segment1_111
jmp segment1_110
segment1_000:
mov a,com_000_table
jmp segment1_next
segment1_001:
mov a,com_001_table
jmp segment1_next
segment1_010:
mov a,com_010_table
jmp segment1_next
segment1_011:
mov a,com_011_table
jmp segment1_next
segment1_100:
mov a,com_100_table
jmp segment1_next
segment1_101:
mov a,com_101_table
jmp segment1_next
segment1_110:
mov a,com_110_table
jmp segment1_next
segment1_111:
mov a,com_111_table
segment1_next:
add a,pulse_count
mov tblp,a
tabrdl acc
clr segment1
sz acc
set segment1
;------------------------
segment2_out:
clr acc
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -