《温湿度检测源程序2.doc》由会员分享,可在线阅读,更多相关《温湿度检测源程序2.doc(15页珍藏版)》请在金锄头文库上搜索。
1、SCK BIT P2.3 DATAI BIT P2.4 SCL EQU P0.5SDA EQU P0.6 ORG 0000H MOV SP,#70H AJMP zhongduan ORG 0023H LJMP SR ORG 0100Hzhongduan: MOV TMOD,#20H MOV PCON,#00H MOV TL1,#0FDH MOV TH1,#0FDH SETB TR1 MOV SCON,#50H MOV IE, #90H MOV R0,#21H MAIN: MOV 20H, #55H MOV 21H, #40H LCALL WRN START1:LCALL CHUANGANQI
2、START2:MOV 3DH, 30H MOV R2, #40H START3:LCALL DISPLAY DJNZ R2, START3 LCALL RDN LCALL DISPLAY MOV A, 3DH CJNE A, 3EH,ABOVE ABOVE: JNC ABOVE1 CJNE A, 3FH,BELOWBELOW: JC BELOW1 SETB P2.6 SETB P2.7 LCALL DISPLAY LJMP AA1ABOVE1:CLR P2.6 SETB P2.7 LCALL DISPLAY LJMP AA1BELOW1:SETB P2.6 CLR P2.7 LCALL DIS
3、PLAY LJMP AA1AA1:JNB P0.0 , AA9 LJMP START1AA9:LCALL DELAY1 JNB P0.0 ,ANJIAN LJMP START1 ANJIAN:CLR P2.5 LCALL RDN MOV 20H,3EH MOV 21H,3FH AB1:JB P0.0,AB2 LJMP AB1 AB2:LCALL AA6 AB9:JB P0.1,AA4 LCALL DELAY1 JB P0.1,AA4 AB4:JB P0.1,AB3 LJMP AB4AB3:MOV A, 20H ADD A, #01H DA A MOV 20H, A LCALL AA6AA4:J
4、B P0.2, AA5 LCALL DELAY1 JB P0.2, AA5 AB5:JB P0.2,AB6 LJMP AB5AB6:MOV A, 20H CLR C SUBB A, #01H MOV 20H, A ANL A, #0FH CJNE A, #0FH,AAC MOV A, 20H ANL A, #0F0H ORL A, #09H MOV 20H, A AAC:LCALL AA6 AA5:LCALL AA6 JB P0.0 , AB9 LCALL DELAY1 JB P0.0 , AB9AB7:JB P0.0 ,AB8 LJMP AB7AB8:SETB P2.5 LCALL WRN
5、LJMP START1 AA6:MOV 30H,20H MOV 31H,21H LCALL DISPLAYDELAY1: MOV R5, #10 DL1:MOV R4,#00H DL2:DJNZ R4,DL2 DJNZ R5,DL1 RET CHUANGANQI: NOP CLR SCK SETBDATAI ACALL TS1 SETB DATAI ACALLCT01 SETB DATAI NOPT001: JNBDATAI,RCT01 NOP NOP AJMPT001RCT01: ACALLRC01 MOV 60H,R2 MOV 61H,R3 CLR C MOV R4,60H MOV R5,
6、61H MOV R6,#3EH MOV R7,#80H ACALL NSUB JNC THH1 MOV 62H,R4 MOV 63H,R5 AJMP TJX1THH1: MOV 62H,R6 MOV 63H,R7 TJX1: CLR C TJX2: MOV R4,#00H MOV R5,#00H MOV R6,62H MOV R7,63H MOV R2,#00H MOV R3,#64H ACALL NDIV1 MOV 6AH,R6 MOV 6BH,R7 NOP ACALL XYSHC NOP CLR SCK SETB DATAI ACALL TS1 NOP SETB DATAI ACALL C
7、T11 SETB DATAI NOPT0012: JNB DATAI,RCT12 AJMP T0012RCT12: ACALL RC01 NOP MOV 64H,R2 MOV 65H,R3 MOV R2,64H MOV R3,65H MOV R6,64H MOV R7,65H ACALL QKUL MOV R2,#27H MOV R3,#10H ACALL NDIV1 MOV A,R6 MOV R2,A MOV A,R7 MOV R3,A MOV R6,#01H MOV R7,#18H ACALL QKUL MOV R2,#00H MOV R3,#64H ACALL NDIV1 MOV A,R6 MOV R4,A MOV A,R7 MOV R5,A MOV R2,#01H MOV R3,#90H ACALL NADD MOV 6EH,R6 MOV 6FH,R7 MOV R2,64H