|
|
start
;-------------- SW ON timer--------------
clr cu1
clr cu2
mov cu3,#2
st1 nop
djnz cu1,st1
djnz cu2,st1
djnz cu3,st1
clr ittm
clr weekcu
mov daytcu[0],#1
mov daytcu[1],#1
clr tmdt[0]
clr tmdt[1]
mov erfg,#0
;-------------- I/O set ------------
mov !ra,#10000b ; ra set
mov !rb,#00011111b ; rb set
clr rb
clr ra
;------------- option (int & tmr0 )set---------
setb rp0
mov option,#00000010b ;1:8 プリスケーラ
clrb rp0
mov intcon,#00100000b ;tmr0 int on
call lcd_init
call inrb
jb bf.3,tmset
call uhp
mov lcu2,#16
setb lcrs
clr lcu1
tmset call lcd_init
call uhp
;--------- date set -------------
mov dspno,#0
call dwdsp
dayset_1 call dclr
call dhp
call dspdait
call swait
dayset_2 call inrb
jnb bf.0,weekset_0
jnb bf.1,dayset_3
jb bf.2,dayset_2
inc daytcu[1]
cjbe daytcu[1],#31,dayset_1
mov daytcu[1],#1
goto dayset_1
dayset_3 inc daytcu[0]
cjbe daytcu[0],#12,dayset_1
mov daytcu[0],#1
goto dayset_1
;-------- week set -------------
weekset_0 call swait
call uhp
mov dspno,#1
call dwdsp
weekset_1 call dclr
call dhp
call weekdsp
call swait
weekset_2 call inrb
jnb bf.0,timeset_0
jb bf.1,weekset_2
inc weekcu
cjbe weekcu,#6,weekset_1
clr weekcu
goto weekset_1
;-------- time set -------------
timeset_0 call swait
call uhp
clrb gie
mov lcu2,#16
setb lcrs
clr lcu1
st3 mov w,lcu1 ;dsp clock set
call dsp2
mov bf,w
call lcdsp
inc lcu1
djnz lcu2,st3
st4 call tmdspd
call swait
st4_nd call inrb
jnb bf.0,st6
jb bf.1,st5
call ttset
goto st4
st5 jb bf.2,st4_nd
call mtset
goto st4
st6 call swait
clr tuff
clr ittm
setb gie
call uhp
mov lcu2,#16
setb lcrs
clr lcu1
call uclr
call dhp
call dclr
goto cuu1
main cjne tuff,#0,cuupds
main_0 call inrb
jnb bf.0,ftmset
goto main
ftmset call swait
goto tmset
;----------- 1s up ----------------
cuupds cjbe tuff,#59,main_0
sub tuff,#60
inc tmdt[1]
cjne tmdt[1],#60,cuu1
clr tmdt[1]
inc tmdt[0]
cjae tmdt[0],#24,dateup
cuu1 call uclr
call uhp
call dspdait
mov bf,#20h
call lcdsp
call weekdsp
mov bf,#20h
call lcdsp
call tmdsp2
goto main
dateup clr tmdt[0]
inc weekcu
cjbe weekcu,#6,dateup_1
clr weekcu
dateup_1 inc daytcu[1]
cje daytcu[0],#2,dateup_2
cjbe daytcu[1],#30,cuu1
cje daytcu[1],#32,monup
cje daytcu[0],#4,monup
cje daytcu[0],#6,monup
cje daytcu[0],#9,monup
cje daytcu[0],#11,monup
goto cuu1
dateup_2 cjbe daytcu[1],#28,cuu1
monup mov daytcu[1],#1
inc daytcu[0]
cjne daytcu[0],#13,cuu1
mov daytcu[0],#1
goto cuu1
;------------ sub -----------------
dspdait mov bf,daytcu[0]
call dm24
call dspbf
mov bf,#'/'
call lcdsp
mov bf,daytcu[1]
call dm60
call dspbf
ret
; set時間表示
tmdsp call uclr
call uhp
goto tmdsp2
tmdspd call dclr
call dhp
tmdsp2 mov bf,tmdt[0]
call dm24
call dspbf
mov bf,#':'
call lcdsp
mov bf,tmdt[1]
call dm60
call dspbf
ret
dspbf setb lcrs
swap bf
mov ra,#3
call env
mov ra,bf
call env
swap bf
mov ra,#3
call env
mov ra,bf
call env
ret
ttset inc tmdt[0]
cjae tmdt[0],#24,ttset1
ret
ttset1 clr tmdt[0]
ret
mtset inc tmdt[1]
cjae tmdt[1],#60,mtset1
ret
mtset1 clr tmdt[1]
ret
http://homepage2.nifty.com/JG1FJC/
|
|