orl a,#02h movx @dptr, a anl a,#0fDh movx @dptr, a mov a, r3 djnz B, DLP
mov dptr, #OUTBIT mov a, r2
movx @dptr, a ; 显示一位八段管 mov r6, #1 call Delay
mov a, r2 ; 显示下一位 rr a
mov r2, a inc r0
djnz r1, Loop
mov dptr, #OUTBIT mov a, #0
movx @dptr, a ; 关所有八段管 ret
Start: mov dptr,#0e100h mov a,#03h movx @dptr,a mov sp, #40h mov Num, #0 MLoop: inc Num mov a, Num mov b, a
mov r0, #LEDBuf FillBuf: mov a, b anl a, #0fh
mov dptr, #LEDMap
movc a, @a+dptr ; 数字转换成显示码 mov @r0,a ; 显示在码填入显示缓冲 inc r0 inc b
cjne r0, #LEDBuf+6, FillBuf mov DelayT,#30 DispAgain:
call DisplayLED ; 显示 djnz DelayT,DispAgain ljmp MLoop