用汇编程序编写秒表的程序

时间:2014-04-20 14:32:41
【文件属性】:

文件名称:用汇编程序编写秒表的程序

文件大小:1KB

文件格式:ASM

更新时间:2014-04-20 14:32:41

汇编

timer_value equ 30h disp_h equ 31h disp_l equ 32h timer_cs equ 33h org 0000h ajmp main org 000bh ajmp time0 org 0030h main: acall init loop: mov a,timer_value cjne a,#60,next mov timer_value,#0 next: acall disp ajmp loop init: mov tmod,#01h mov th0,#3ch mov tl0,#0b0h setb tr0 setb et0 setb ea setb p3.3 setb p3.2 mov timer_value,#0 mov disp_h,#0 mov disp_l,#0 mov timer_cs,#20 time0: clr tr0 mov th0,#3ch mov tl0,#0b0h djnz timer_cs,time0_end mov timer_cs,#20 inc timer_value time0_end: setb tr0 reti dmzh: mov a,timer_value mov b,#10 div ab mov disp_h,a mov disp_l,b ret disp: acall dmzh mov dptr,#tab mov a,disp_h movc a,@a+dptr cpl a mov p1,a clr p3.3 acall delay setb p3.3 mov dptr,#tab mov a,disp_l movc a,@a+dptr cpl a mov p1,a clr p3.2 acall delay setb p3.2 ret delay: mov r3,#10 del2: mov r4,#250 del1: djnz r4,del1 djnz r3,del2 ret tab: db 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,77H,7CH,39H,5EH,79H,71H end 


网友评论