电子秒表汇编程序-精度高
这几天,一直在写电子秒表程序,今天终于调试出来了!感觉还不错,很好!误差非常小,很适合做电子时钟
源程序的一个小模块,现把源代码上传,和大家一起分享一下!!
ORG 0000HSJMP STARTORG 000BHLJMP TIME0ORG 001BHLJMP TIME1ORG 0045HSTART:MOV SP,#60HMOV 40H,#0MOV 41H,#0MOV 30H,#0MOV 31H,#0MOV 32H,#0MOV 33H,#0SETB EASETB ET0SETB ET1MOV TMOD,#11HMOV TL1,#80HMOV TH1,#0C1HMOV TL0,#0B0HMOV TH0,#3CHMOV R2,#20SETB PT0SETB P2.5SETB TR0SETB TR1SJMP $TIME0:PUSH ACCPUSH PSWMOV TL0,#0B0HMOV TH0,#3CHDJNZ R2,BACKMOV R2,#20INC 40HMOV A,40HMOV B,#10DIV ABMOV 30H,AMOV A,BMOV 31H,AMOV A,40HCJNE A,#60,BACKMOV 30H,#0MOV 31H,#0MOV 40H,#0INC 41HMOV A,41HMOV B,#10DIV ABMOV 32H,AMOV A,BMOV 33H,AMOV A,41HCJNE A,#60,BACKMOV 32H,#0MOV 33H,#0MOV 41H,#0BACK:POP PSWPOP ACCRETITIME1:PUSH ACCPUSH PSWMOV TL1,#80HMOV TH1,#0C1HMOV DPTR,#TAB1MOV R0,#31HMOV A,@R0MOVC A,@A+DPTRMOV P0,ASETB P2.0CLR P2.3LCALL DELAYSETB P2.2SETB P2.1MOV R1,#30HMOV A,@R1MOVC A,@A+DPTRSETB P2.3MOV P0,ASETB P2.0CLR P2.2LCALL DELAYMOV DPTR,#TAB2MOV A,33HMOVC A,@A+DPTRSETB P2.2MOV P0,ASETB P2.0CLR P2.1LCALL DELAYMOV DPTR,#TAB1MOV A,32HMOVC A,@A+DPTRSETB P2.1MOV P0,ACLR P2.0LCALL DELAYPOP PSWPOP ACCRETIDELAY:MOV R7,#02HDL:MOV R6,#0FFHDL1:DJNZ R6,DL1DJNZ R7,DLRETTAB1:DB 0C0H,0F9H,0A4H,0B0H,99HDB 92H,82H,0F8H,80H,90HTAB2:DB 40H,79H,24H,30H,19HDB 12H,02H,78H,00H,10HEND
评论