新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > 单片机打铃器设计

单片机打铃器设计

作者:时间:2013-03-12来源:网络收藏

st z,temp
rcall display
sbis pinb,5
rjmp cloc ;进入时间设置
dec temp3
brne BP4M2
inc temp3
dec temp4
brne BP4M2
BP4M3: ldi temp3,$ff
ldi temp4,$f
BP4M4: clr yh
ldi yl,low(DISBUF) ;设置显示labor.
ldi temp,25
st y+,temp
ldi temp,19
st y+,temp
ldi temp,10
st y+,temp
ldi temp,11
st y+,temp
ldi temp,20
st y+,temp
ldi temp,22
st y,temp
ldi zl,low(XSDBZ)
clr zh
ldi temp,0b00100000 ;b0-5对应LED自左到右1-6位的小数点,置“1”在该位置小数点。
st z,temp
rcall display
sbis pinb,5
rjmp GNCS1 ;进入工作参数设置
dec temp3
brne BP4M4
inc temp3
dec temp4
brne BP4M4
sbic pinb,4
rjmp BP4M
rjmp res1
;****时钟调整***********************************************
cloc: clr temp
out timsk,temp ;不许T0中断
cli ;关中断
rcall colodis
mov temp,r10
clr temp4
ldi temp1,20
ldi temp3,$80
cloc3: ldi yl,low(DISBUF)
add yl,temp4
sbic pinb,5 ;选择时分秒
rjmp cloc4
dec temp1
brne cloc4
ldi temp1,80
inc temp4
inc temp4
add yl,temp4
cpi yl,$68
brmi cloc4
clr temp4
ldi yl,low(DISBUF)
cloc4: nop
sbic pinb,6 ;调整时分秒值
rjmp cloc8
dec temp3
brne cloc8
ldi temp3,$20
cloc5: cpi yl,$60
brne cloc6
inc r10
mov temp,r10
cpi temp,24
brmi cloc8
clr temp
clr r10
cloc6: cpi yl,$62
brne cloc7
inc r11
mov temp,r11
cpi temp,60
brmi cloc8
clr temp
clr r11
cloc7: cpi yl,$64
brne cloc8
inc r12
mov temp,r12
cpi temp,60
brmi cloc8
clr temp
clr r12
cloc8: cpi yl,$60
brne cloc9
ldi zl,low(XSDBZ)
clr zh
ldi temp,0b00000010 ;b0-5对应LED自左到右1-6位的小数点,置“1”在该位置小数点。
st z,temp
mov r16,r10
rjmp cloc11
cloc9: cpi yl,$62
brne cloc10
ldi zl,low(XSDBZ)
clr zh
ldi temp,0b00001000 ;b0-5对应LED自左到右1-6位的小数点,置“1”在该位置小数点。
st z,temp
mov r16,r11
cloc10: cpi yl,$64
brne cloc11
ldi zl,low(XSDBZ)
clr zh
ldi temp,0b00100000 ;b0-5对应LED自左到右1-6位的小数点,置“1”在该位置小数点。
st z,temp
mov r16,r12
cloc11: rcall bto
st y+,r3
st y,r4
rcall display
sbis pinb,4 ;退出
rjmp cloc12
rjmp cloc3
cloc12: ldi temp,$02
out timsk,temp ;允许T0中断
sei ;开中断
rjmp res1

;****32点工作参数调整**********************************************************

GNCS1: clr r25 ;首个控制点
clr r22 ;r22为0显示开关页面,为1显示h-xx页面,为2显示m-xx页面,为3显示c-xx页面
ldi zl,low(XSDBZ)
clr zh
ldi r19,0b00000010
st z,r19
gncs: ldi r17,TIMECTR ;首个控制点EEPRON地址
clr r18
ldi yl,low(DISBUF) ;设置显示缓冲区起始地址
clr yh
lsl r25
lsl r25
add r17,r25 ;取得EEPRON中控制点地址(Aj=A0+4*j),A=(r17),j=(r25)
lsr r25
lsr r25
mov r16,r25
rcall bto
st y+,r3
st y+,r4
cpi r22,0
breq kgymxs
cpi r22,1
breq hymxs
cpi r22,2
breq mymxs
cpi r22,3
breq cymxs
clr r22
rjmp gncs
kgymxs: rcall EERead
cpi r16,0
brne offxs
ldi r23,27 ;显示xx.--on
st y+,r23
st y+,r23
ldi r23,20
st y+,r23
ldi r23,26
st y,r23
rjmp gzcsxs
offxs: ldi r23,27 ;显示xx.-off
st y+,r23
ldi r23,20
st y+,r23
ldi r23,15
st y+,r23
st y,r23
rjmp gzcsxs
hymxs: ldi r23,28 ;显示xx.h-aa
st y+,r23
ldi r23,27
st y+,r23
inc r17
rcall EERead
rcall bto
st y+,r3
st y+,r4
dec r17
rjmp gzcsxs
mymxs: ldi r23,26 ;显示xx.n-aa
st y+,r23
ldi r23,27
st y+,r23
inc r17
inc r17
rcall EERead
rcall bto
st y+,r3
st y+,r4
dec r17
dec r17
rjmp gzcsxs
cymxs: ldi r23,18 ;显示xx.c-aa
st y+,r23
ldi r23,27
st y+,r23
inc r17
inc r17
inc r17
rcall EERead
rcall bto
st y+,r3
st y+,r4
dec r17
dec r17
dec r17
gzcsxs: ldi r23,40
ldi r24,40
gzcsxs1: rcall display
sbis pinb,5 ;翻页
rjmp fycz ;有,去翻页
sbis pinb,6 ;变值
rjmp bzcz ;有,去变值
sbis pinb,4 ;复位
rjmp res1 ;有,去复位
rjmp gncs



评论


相关推荐

技术专区

关闭