1、SCK BIT P2.3 DATAI BIT P2.4 SCL EQU P0.5SDA EQU P0.6ORG 0000HMOV SP,#70HAJMP zhongduanORG 0023H LJMP SRORG 0100Hzhongduan: MOV TMOD,#20H MOV PCON,#00H MOV TL1,#0FDH MOV TH1,#0FDH SETB TR1 MOV SCON,#50HMOV IE, #90H MOV R0,#21H MAIN: MOV 20H, #55H MOV 21H, #40H LCALL WRN START1:LCALL CHUANGANQI START2
2、:MOV 3DH, 30H MOV R2, #40H START3:LCALL DISPLAY DJNZ R2, START3LCALL RDNLCALL DISPLAYMOV A, 3DH CJNE A, 3EH,ABOVE ABOVE: JNC ABOVE1 CJNE A, 3FH,BELOWBELOW: JC BELOW1SETB P2.6SETB P2.7LCALL DISPLAYLJMP AA1ABOVE1:CLR P2.6SETB P2.7LCALL DISPLAYLJMP AA1BELOW1:SETB P2.6CLR P2.7LCALL DISPLAYLJMP AA1AA1:JN
3、B P0.0 , AA9LJMP START1AA9:LCALL DELAY1 JNB P0.0 ,ANJIANLJMP START1 ANJIAN:CLR P2.5 LCALL RDN MOV 20H,3EHMOV 21H,3FH AB1:JB P0.0,AB2LJMP AB1 AB2:LCALL AA6 AB9:JB P0.1,AA4 LCALL DELAY1 JB P0.1,AA4 AB4:JB P0.1,AB3LJMP AB4AB3:MOV A, 20HADD A, #01HDA AMOV 20H, ALCALL AA6AA4:JB P0.2, AA5 LCALL DELAY1 JB
4、P0.2, AA5 AB5:JB P0.2,AB6LJMP AB5AB6:MOV A, 20HCLR CSUBB A, #01HMOV 20H, AANL A, #0FHCJNE A, #0FH,AACMOV A, 20HANL A, #0F0HORL A, #09HMOV 20H, A AAC:LCALL AA6 AA5:LCALL AA6JB P0.0 , AB9LCALL DELAY1JB P0.0 , AB9AB7:JB P0.0 ,AB8LJMP AB7AB8:SETB P2.5LCALL WRNLJMP START1 AA6:MOV 30H,20HMOV 31H,21H LCALL
5、 DISPLAYDELAY1: MOV R5, #10DL1:MOV R4,#00HDL2:DJNZ R4,DL2DJNZ R5,DL1RET CHUANGANQI: NOPCLR SCK SETB DATAI ACALL TS1 SETB DATAIACALL CT01 SETB DATAINOPT001: JNB DATAI,RCT01NOPNOPAJMP T001RCT01: ACALL RC01 MOV 60H,R2 MOV 61H,R3CLR C MOV R4,60HMOV R5,61HMOV R6,#3EH MOV R7,#80HACALL NSUB JNC THH1 MOV 62
6、H,R4MOV 63H,R5AJMP TJX1THH1: MOV 62H,R6MOV 63H,R7 TJX1: CLR C TJX2: MOV R4,#00HMOV R5,#00HMOV R6,62HMOV R7,63HMOV R2,#00H MOV R3,#64HACALL NDIV1 MOV 6AH,R6 MOV 6BH,R7 NOPACALL XYSHC NOPCLR SCK SETB DATAIACALL TS1NOPSETB DATAIACALL CT11 SETB DATAI NOPT0012: JNB DATAI,RCT12 AJMP T0012RCT12: ACALL RC01
7、 NOPMOV 64H,R2MOV 65H,R3MOV R2,64HMOV R3,65HMOV R6,64HMOV R7,65HACALL QKUL MOV R2,#27H MOV R3,#10H ACALL NDIV1 MOV A,R6MOV R2,AMOV A,R7MOV R3,AMOV R6,#01H MOV R7,#18H ACALL QKUL MOV R2,#00H MOV R3,#64H ACALL NDIV1 MOV A,R6MOV R4,AMOV A,R7MOV R5,AMOV R2,#01H MOV R3,#90H ACALL NADD MOV 6EH,R6MOV 6FH,R
8、7 MOV R2,64H MOV R3,65HMOV R6,#01H MOV R7,#95HACALL QKUL MOV R2,#00H MOV R3,#64HACALL NDIV1 MOV A,R6MOV R4,AMOV A,R7MOV R5,AMOV R6,6EHMOV R7,6FHACALL NSUB MOV 6CH,R2 MOV 6DH,R3MOV R2,64HMOV R3,65H MOV R6,#00H MOV R7,#08HACALL QKUL MOV R2,#03H MOV R3,#0E8H ACALL NDIV1 MOV A,R6MOV R4,AMOV A,R7MOV R5,A
9、MOV R2,#00H MOV R3,#01HACALL NADD MOV 64H,R6MOV 65H,R7 MOV R4,6AH MOV R5,6BH MOV R6,#00H MOV R7,#41H CLR CACALL NSUB JC RHH1 MOV R6,64HMOV R7,65H ACALL QKUL MOV A,R6MOV R2,AMOV A,R7MOV R3,AMOV R4,6CHMOV R5,6DHACALL NADD MOV A,R6 MOV R2,AMOV A,R7MOV R3,AAJMP ZHJRHH1: MOV R4,#00H MOV R5,#41HMOV R6,6AH
10、MOV R7,6BHACALL NSUB MOV R6,64HMOV R7,65HACALL QKUL MOV R4,6CHMOV R5,6DHACALL NSUB ZHJ: MOV R6,#00H MOV R7,#64HACALL QKUL MOV R2,#27H MOV R3,#10HACALL NDIV1 MOV 30H,R7NOPACALL XYSHCNOPRETTS1: SETB DATAICLR SCKMOV R7,#09H TS2: SETB SCKCLR SCKDJNZ R7,TS2SETB SCKCLR DATAICLR SCKSETB SCKSETB DATAICLR SC
11、KRETCT01: CLR SCK CLR DATAIMOV R7,#05H CT02: SETB SCKCLR SCKDJNZ R7,CT02SETB SCKCLR SCKSETB DATAISETB SCKCLR SCKSETB SCKCLR SCKCLR DATAISETB SCKCLR SCKSETB DATAIRETCT11: CLR SCK CLR DATAIMOV R7,#05H CT12: SETB SCKCLR SCKDJNZ R7,CT12SETB DATAISETB SCK CLR SCKCLR DATAISETB SCKCLR SCKSETB DATAISETB SCK
12、CLR SCKCLR DATAI ;SETB SCKCLR SCKSETB DATAIRETNADD: MOV A,R5ADD A,R3MOV R7,AMOV A,R4ADDC A,R2MOV R6,ARETNSUB: MOV A,R5SUBB A,R7MOV R3,AMOV A,R4SUBB A,R6MOV R2,ARETQKUL: MOV A,R3MOV B,R7MUL ABXCH A,R7MOV R5,BMOV B,R2MUL ABADD A,R5MOV R4,ACLR AADDC A,BMOV R5,AMOV A,R6MOV B,R3MUL ABADD A,R4XCH A,R6XCH
13、A,BADDC A,R5MOV R5,AMOV PSW.5,CMOV A,R2MUL ABADD A,R5MOV R5,ACLR AMOV ACC.0,CMOV C,PSW.5ADDC A,BMOV R4,ARETNDIV1: MOV A,R5 CLR CSUBB A,R3MOV A,R4SUBB A,R2JNC NDVE1MOV B,#16NDVL1:CLR CMOV A,R7RLC AMOV R7,AMOV A,R6RLC AMOV R6,AMOV A,R5RLC AMOV R5,AXCH A,R4RLC AXCH A,R4MOV PSW.5,CCLR CSUBB A,R3MOV R1,A
14、MOV A,R4SUBB A,R2JB PSW.5,NDVM1JC NDVD1NDVM1: MOV R4,AMOV A,R1MOV R5,AINC R7NDVD1: DJNZ B,NDVL1CLR PSW.5RETNDVE1: SETB PSW.5RETXYSHC: MOV R6,#6FH YYWC: MOV R7,#6FH YYNC: NOPDJNZ R7,YYNCDJNZ R6,YYWCNOPRETRC01: SETB DATAI CLR SCKCLR AMOV R7,#08HRC02: SETB SCKMOV C,DATAIRLC ACLR SCKDJNZ R7,RC02CLR SCKMOV R2,ACLR DATAISETB SCKCLR SCKSETB DATAICLR AMOV R7,#08HRC03: SETB SCKMOV C,DATAIRLC ACLR SCKDJNZ R7,RC03CLR SCKMOV R3,ACLR DATAISETB SCKCLR SCKSETB DATAIRET DISPLAY:SETB P2.0SETB P2.1SETB P2.2MOV A, 30HANL A, #0FHMOV R6, AMOV A, 30HANL A, #0F0HSWAP AMOV B, #10H
Copyright © 2018-2021 Wenke99.com All rights reserved
工信部备案号:浙ICP备20026746号-2
公安局备案号:浙公网安备33038302330469号
本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。