用数码管就可以了,比如用共阳的数码管,程序如下:(89C52) cs0809 equ 08000h aa: mov b,#51 div ab movc a,@a+dptr clr p3.0 setb p3.1 数码管的COM端 setb p3.2 mov dptr,#cs0809 movx @dptr,a orl a,#80h mov p1,a call delay
setb p3.0 clr p3.1 setb p3.2 mov a,b mov b,#5 div ab mov dptr,#tab movc a,@a+dptr mov dptr,#cs0809 movx @dptr,a mov p1,a call delay
setb p3.0 setb p3.1 clr p3.2 mov a,b mov b,#10 mul ab mov b,#51 div ab mov dptr,#tab movc a,@a+dptr mov dptr,#cs0809 movx @dptr,a mov p1,a call delay ljmp aa tab: db 3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh delay: mov r7,#0 mov r6,#10 delayloop: djnz r7,delayloop djnz r6,delayloop ret end |