跑马灯程序
org 0000h
ljmp 0030h
org 0030h
mov p1,#0ffh
start:
mov r0,#0
mov r1,#0feh
mov dptr,#lighttab
keyboard:
mov p3,#0ffh
mov a,p3
cjne a,#0ffh,kb0
ajmp kb3
kb0:
mov p3,#0ffh
mov a,p3
cjne a,#0ffh,kb0
inc r0
cjne r0,#3,kb1
ajmp start
kb1:
mov a,r0
movc a,@a+dptr
mov r1,a
kb3:
mov a,r1
mov p1,a
acall delay
rl a
mov r1,a
ajmp keyboard
lighttab:
db 0feh,0fch,0fah
delay:
mov r3,#40h
dy0:
mov r4,#0ffh
dy1:
mov r5,#0ffh
dy2:
djnz r5,dy2
djnz r4,dy1
djnz r3,dy0
ret
end
数码管测试程序
org 0000h
ljmp 0030h
org 0030h
ledshow:
mov dptr,#ledtab
mov r0,#0
ls0:
mov a,r0
movc a,@a+dptr
mov p0,#00h
acall delay
mov p0,a
mov a,r0
mov p2,a
acall delay
inc r0
cjne r0,#8,ls0
ajmp ledshow
ledtab:
db 3fh,06h,5bh,4fh,66h
db 6dh,7dh,07h,7fh,67h
delay:
mov r6,#0f0h
dys0:
djnz r6,dys0
ret
end
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |