直在電腦前,寫了三天,這才完成了第二步,可以調(diào)時(shí)間 了,接下來就是鬧鐘的事情,也就是最后一步,繼續(xù)努力!org 0000hajmp mainorg 000bhajmp inti0org 0030hmain:mov tmod,#01hmov ie,#82hmov th0,#4chmov tl0,#00hmov sp,#60hmov r0,#20setb tr0loop:lcall displaylcall keysanajmp loopinti0:push pswpush accclr eamov th0,#4chmov tl0,#00hdjnz r0,out ;1秒計(jì)數(shù)是否到mov r0,#20 inc 31h ;秒加1mov a,31hcjne a,#60,out ;60秒計(jì)數(shù)是否到mov 31h,#00inc 32h ;分加1mov a,32hcjne a,#60,out ;60分計(jì)數(shù)是否到mov 32h,#00inc 33h ;時(shí)加1mov a,33hcjne a,#24,out ;24時(shí)是否到mov 33h,#00out: setb eapop accpop pswretidisplay:mov a,31h ;秒顯示mov b,#10div abmov 20h,amov 21h,bdisp1: mov a,20h ;秒十位顯示mov dptr,#tablemovc a,@a+dptrmov p0,aclr p2.6lcall del1mssetb p2.6disp2: mov a,21h ;秒個(gè)位顯示mov dptr,#tablemovc a,@a+dptrmov p0,aclr p2.7lcall del1mssetb p2.7disp4: mov a,32h ;分顯示mov b,#10div abmov 22h,amov 23h,bdisp5: mov a,22h ;分十位顯示mov dptr,#tablemovc a,@a+dptrmov p0,aclr p2.3lcall del1mssetb p2.3disp6: mov a,23h ;分個(gè)位顯示mov dptr,#tablemovc a,@a+dptrmov p0,aclr p2.4lcall del1mssetb p2.4disp7: mov a,33h ;時(shí)顯示mov b,#10div abmov 24h,amov 25h,bdisp8: mov a,24h ;時(shí)十位顯示mov dptr,#tablemovc a,@a+dptrmov p0,aclr p2.0lcall del1mssetb p2.0disp9: mov a,25h ;時(shí)個(gè)位顯示mov dptr,#tablemovc a,@a+dptrmov p0,aclr p2.1lcall del1mssetb p2.1disp10: mov 34h,#0bfh ;"-"顯示mov a,34hmov p0,aclr p2.5lcall del1mssetb p2.5disp11: mov 35h,#0bfh ;"-"顯示mov a,35hmov p0,aclr p2.2lcall del1mssetb p2.2ret
評論