📄 vfd.asm
字号:
;**************************************
; input: shifter0, shifter1
; output: shift out 16bits to the shiter
;
shifter_set:
clr KIN_CTRL ;make it output pin.
clr _shifter_c ;
; clr _shifter_s ;so the Q7-Q0 output data will remain unchanged.
mov a, 16 ;total 16 bits
shift_loop:
rlc shifter0 ;MSB first.
rlc shifter1 ;
sz c ;
set _shifter_d ;
snz c ;
clr _shifter_d ;
nop ;
nop ;
nop ;
set _shifter_c ;rising edge trigger.
nop ;
nop ;
nop ;
clr _shifter_c ;
sdz acc ;
jmp shift_loop ;
rlc shifter0 ;so, shift_buf remain unchanged.
rlc shifter1 ;
nop ;
; set _shifter_s ;output the shifted date, and the _clk pin is low.
nop ;
nop ;
; clr _shifter_s ;latch up the data, keep unchanged.
ret ;
;**********************************************;
disp_nopot:
mov a, ROM_MINUS ;
mov disp_buf0, a ;
mov disp_buf1, a ;
mov disp_buf2, a ;
ret ;
;**********************************************;
FillBlank:
clr disp_buf0 ;
clr disp_buf1 ;
clr disp_buf2 ;
ret ;
;**********************************************;
; when adjust time_preset, store the old value first.
FillTimeShadow:
mov a, time_shadow ;
call hex2bcd ;
jmp FillValue ;
;**********************************************;
FillTimeValue:
mov a, time_preset ;
call hex2bcd ;
jmp FillValue ;
;********************************************************************
; input: acc
; output: w2,w1,w0
;********************************************************************
hex2bcd:
div100:
set w2 ;
div100_lp:
inc w2 ;w2= acc/100
sub a, 100 ;
sz c ;
jmp div100_lp ;
add a, 100 ;
; jmp div10 ;
div10:
set w1 ;
div10_lp:
inc w1 ;
sub a, 10 ;
sz c ;
jmp div10_lp ;
add a, 10 ;
mov w0, a ;w1*10 + w0
ret ;
;**********************************************;
; INPUT: w2, w1, w0
; OUTPUT: disp_buf2,1,0
;
FillValue:
;dgt2
clr disp_buf2 ;
sz w2 ;
jmp $+2 ;
jmp fv_aa ;
mov a, w2 ;
add a, LOW(CharRomTbl) ;
mov tblp, a ;tblp ready.
tabrdl disp_buf2 ;
;dgt1
fv_aa:
clr disp_buf1 ;
sz w1 ;
jmp fvaa_go ;
sz w2 ;
jmp fvaa_go ;
jmp fv_bb ;
fvaa_go:
mov a, w1 ;
add a, LOW(CharRomTbl) ;
mov tblp, a ;tblp ready.
tabrdl disp_buf1 ;
fv_bb:
mov a, w0 ;
add a, LOW(CharRomTbl) ;
mov tblp, a ;tblp ready.
tabrdl disp_buf0 ;
ret
;**************************************
disp_update:
clr _DGT1 ;
clr _DGT2 ;
jmp shifter_set ;
;********************************************************************
DispModeLed:
mov a, mode_state ;
add a, low(ModeDispTbl) ;
mov tblp, a ;
tabrdl acc ;
clr vLED_MODE0 ;
sz acc.0 ;
set vLED_MODE0 ;
clr vLED_MODE1 ;
sz acc.1 ;
set vLED_MODE1 ;
clr vLED_MODE2 ;
sz acc.2 ;
set vLED_MODE2 ;
clr vLED_MODE3 ;
sz acc.3 ;
set vLED_MODE3 ;
clr vLED_MODE4 ;
sz acc.4 ;
set vLED_MODE4 ;
clr vLED_MODE5 ;
sz acc.5 ;
set vLED_MODE5 ;
ret ;
;**********************************************;
DispForceLed:
mov a, force_preset ;
add a, low(ForceDispTbl) ;
mov tblp, a ;
tabrdl acc ;
clr vLED_FORCE0 ;
sz acc.0 ;
set vLED_FORCE0 ;
clr vLED_FORCE1 ;
sz acc.1 ;
set vLED_FORCE1 ;
clr vLED_FORCE2 ;
sz acc.2 ;
set vLED_FORCE2 ;
clr vLED_FORCE3 ;
sz acc.3 ;
set vLED_FORCE3 ;
clr vLED_FORCE4 ;
sz acc.4 ;
set vLED_FORCE4 ;
clr vLED_FORCE5 ;
sz acc.5 ;
set vLED_FORCE5 ;
ret ;
;**************************************************************
display:
;**************************************************************
inc dgt_position ;
mov a, 256-4 ;
add a, dgt_position ;
sz c ;
clr dgt_position ;
mov a, dgt_position ;
addm a, pcl ;
jmp disp_0 ;
jmp disp_1 ;
jmp disp_2 ;
jmp disp_3 ;
;*****
disp_0:
mov a, disp_buf0 ;
sz vLED_ZENDUN ;
set acc.3 ;
mov shifter0, a ;
mov a, LED_buf0 ;
mov shifter1, a ;
call disp_update ;
set _DGT1
set _DGT2
ret ;
;*****
disp_1:
mov a, disp_buf1 ;
mov shifter0, a ;
set shifter1 ;
call disp_update ;
set _DGT1 ;DGT1 ON
ret ;
;*****
disp_2:
mov a, disp_buf2 ;
sz vLED_HUOGUO ;
set acc.3 ;
mov shifter0, a ;
mov a, LED_buf1 ;
mov shifter1, a ;
call disp_update ;
set _DGT2
ret ;DGT2 ON.
;*****
disp_3:
set shifter0 ;prepare for key scan.
set shifter1 ;
call disp_update ;
ret ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -