《单片机温湿度监控装置汇编语言源程序清单.doc》由会员分享,可在线阅读,更多相关《单片机温湿度监控装置汇编语言源程序清单.doc(20页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、 温湿度监控装置汇编语言源程序清单.doc;*WDAT DATA 40H RDAT DATA 41HLdata DATA 42HHdata DATA 43HP0M1 DATA 84HP0M2 DATA 85HP1M1 DATA 91HP1M2 DATA 92HP2M1 DATA 0A4HP2M2 DATA 0A5HTRIM DATA 96HSSTAT DATA 0BAH IEN0 DATA 0A8HIEN1 DATA 0E8HWDL DATA 0C1HWFEED1 DATA 0C2HWFEED2 DATA 0C3HWDCON DATA 0A7HFMCON DATA 0E4HFMDATA DAT
2、A 0E5HFMADRL DATA 0E6HFMADRH DATA 0E7H SPSTAT DATA 0E1HSPCTL DATA 0E2HSPDAT DATA 0E3HRTCCON DATA 0D1HRTCH DATA 0D2HRTCL DATA 0D3H; 定义FLASH控制命令字;*LOAD EQU 00H ; 加载数据PROG EQU 48H ; 编程ERS_PROG EQU 68H ; 擦除编程 ERS_S EQU 71H ; 擦除扇区ERS_P EQU 70H ; 擦除页AN1 BIT P1.5 ;按扭1AN2 BIT P1.3 ;按扭2AN3 BIT P1.2 ;按扭3Read_
3、P BIT P1.4 ;读数据口out BIT P0.0 ;负载输出 ;-变量定义区-;* FLAG EQU 63H U8comdata EQU 64H U8T_data_H EQU 65H U8T_data_L EQU 66H U8RH_data_H EQU 6AH U8RH_data_L EQU 6BH U8checkdata EQU 6CH U8temp EQU 6DH temp EQU 6EH ;* ORG 0000H AJMP INIT_0 ORG 000BH LJMP T0ZD ORG 001BH LJMP T1ZD ORG 0023H LJMP CYKZD ORG 0053H L
4、JMP RTCI ORG 0060H DB 0FCH DB 60H DB 0DAH DB 0F2H DB 66H DB 0B6H DB 0BEH DB 0E0H DB 0FEH DB 0F6H DB 1CH ;L DB 6EH ;H DB 00H ;消隐 DB 00H DB 00H DB 1AH ;c DB 0BCH ;G DB 3AH ;o DB 7AH ;d DB 2EH ;h DB 9EH ;E;* ORG 0080HINIT_0: MOV 22H,#03H MOV 25H,#00H MOV 2AH,#00H MOV 2DH,#00H MOV 2CH,#00H MOV 30H,#00H
5、MOV 31H,#00H MOV 32H,#00H MOV 33H,#00H MOV 34H,#00H MOV 35H,#00H MOV 3DH,#35H MOV 42H,#09H MOV 43H,#01H MOV 45H,#00H MOV 46H,#00H MOV 47H,#00H MOV 48H,#00H MOV 49H,#00H MOV 4BH,#0FH MOV 4CH,#02H MOV 4DH,#0FH MOV 50H,#00H MOV 51H,#0BCH MOV 52H,#3AH MOV 53H,#3AH MOV 54H,#7AH MOV 55H,#00H MOV 5BH,#5 MO
6、V 5DH,#58H MOV P0M1,#00H MOV P0M2,#3DH MOV P1M1,#20H MOV P1M2,#03H MOV P1,#0FFH MOV TCON,#05H;#55H MOV TMOD,#11H MOV SCON,#00H;#10H ;MOV TL0,#0B4H ;MOV TH0,#3CH MOV TL1,#88H MOV TH1,#98H MOV RTCL,#7FH MOV RTCH,#70H MOV RTCCON,#63H MOV IEN0,#0DAH INIT_2: MOV Acc,WDCON SETB Acc.2 MOV WDL,#0FFH CLR EA
7、MOV WDCON,Acc MOV WFEED1,#0A5H MOV WFEED2,#5AH SETB EA INIT_3: MOV 2EH,#00H MOV 2FH,#00H MOV DPTR,#7F1H LCALL RFLASH MOV 31H,RDAT MOV DPTR,#7F2H LCALL RFLASH MOV 32H,RDAT MOV DPTR,#7F6H LCALL RFLASH MOV 26H,RDAT;*MAIN: CLR 2AH ;温度/湿度切换标志位 CLR 58H ;控制信号“开”辅助位 CLR 59H ;读取数据辅助位 SETB 5AH ;FLASH读写辅助位 CLR
8、 5BH ;转换限制辅助位 CLR 5CH ;中继数据保存辅助位 CLR 5DH ;75ms中断延时辅助位 CLR 5EH ;手控开/关辅助位 CLR 7BH ;闪烁辅助位 CLR out ;负载输出 SETB Read_P; MOV R4,#00H LCALL WDT_R LJMP LOOP0KSM00: LJMP KSM0 LOOP0: MOV R1,#53H;#51H MOV R2,#20H;#01H MOV R3,#04HLOOP1: MOV DPH,#00H MOV DPL,#60H MOV A,R1 MOVC A,A+DPTR JNB 6FH, LOOP2 ADD A,#01H C
9、LR 6FHLOOP2: MOV SBUF,A MOV A,P0 ANL A,#03H ORL A,R2 JNB 55H, SSCL JB 7BH, SSCL0 JNB 50H, SSCLSSCL0: ANL A,7BHSSCL: MOV P0,A MOV A,R2 RR A;RL A MOV R2,A ANL A,#3CH CJNE A,#04H, GPPP SETB 6FHGPPP: JNB AN1, KSM00 JNB AN2, KSM00 JNB AN3, KSM00 JNB 72H, ABC ANL 2EH,#00H CLR 72HABC: JB 59H, DEF JB 60H, D
10、EF LCALL Read_WS SETB 59H LCALL OperationDEF: NOP LOOP3: JNB 55H, LOOP4 JB 7BH, XY5 JNB 50H, LOOP4 JB 51H, XY1 JB 52H, XY2 JB 53H, XY3 JB 54H, XY6 JB 56H, XY6 LOOP4: LCALL DELLY JB 50H, GPPPP JB 67H, GPPPP MOV A,R2 JB ACC.3, GPPPPP GPPPP: NOP GPPPPP: NOP LOOP5: JB 28H, LOOP6 JB 60H, LOOP7 JB 65H, LO
11、OP7 LOOP6: JNB 29H, LOOP7 NOPLOOP7: DEC R1;INC R1 DJNZ R3, LOOP10 LCALL WDT_R JNB 72H, LOOP8 JB 76H, JSLOOP8: JB 28H, LOOP00 JB 60H, LOOP00 JNB 7DH, LOOP00 LOOP00: LJMP LOOP0 LOOP10: LJMP LOOP1 XY1: MOV 7BH,#0DFH LJMP LOOP4XY2: MOV 7BH,#0EFH LJMP LOOP4XY3: MOV 7BH,#0F7H LJMP LOOP4XY5: MOV 7BH,#0C3H
12、LJMP LOOP4XY6: MOV 7BH,#0CFH LJMP LOOP4 JS: DJNZ 5DH, LOOP00 JNB 60H, LOOP00 ; CLR 76H MOV 5DH,#25H LJMP LOOP0 LJMP LOOP7 KSM0: JB 75H, LOOP30 JB 76H, LOOP30 JB 77H, KSM1 MOV TL0,#0EBH MOV TH0,#0E0H MOV 67H,#26H MOV 5DH,#55H MOV 48H,#00H MOV 49H,#00H CLR 2FH SETB TCON.4 SETB 75HLOOP30: LJMP LOOP3KSM
13、1: JB 72H, KSM2 JB 76H, LOOP30KSM2: ;SETB 70H ;SETB 73H SETB 76H JNB AN1, KJSGN JNB AN2, KJSYW0 JNB AN3, KJSZL0 LJMP LOOP3 KJSZL0: LJMP KJSZLKJSYW0: LJMP KJSYW LJMP INIT_3KJSGN: JB 60H, KJSGN10 JB 50H, KJSGN10 SETB 7EH DJNZ 22H, LOOP33 CLR 67H CLR 66H SETB 60H CLR 28H MOV 22H,#03H MOV 2AH,#03H MOV 2
14、CH,#03H MOV R4,#01H MOV 78H,31H LCALL HEX_BCDBLOCK MOV 50H,#0AH LOOP33: LJMP LOOP3 KJSGN10: LJMP KJSGN1GN0: LCALL BCD_HEXBLOCK JB 61H, WT1 JB 62H, WT2 JB 63H, SWTCH ANL 2CH,#3FH LJMP LOOP3 WT1: MOV A,#7DH ;#50H CJNE A,5FH, WT11WT110: MOV A,#05H ; ADD A,5FH CJNE A,32H, WT112WT111: MOV 31H,5FH CLR 7AH
15、 MOV DPTR,#7F1H MOV WDAT,5FH;#58H LCALL WFLASH LJMP GNJSWT112: JNC FMCL LJMP WT111 WT11: JC FMCL MOV A,5FH CJNE A,#00H, WT12 LJMP WT111WT12: JC FMCL LJMP WT110 WT2: MOV A,#7DH; CJNE A,5FH, WT21 LJMP WT211WT21: JC FMCL MOV A,#05H ADD A,31H CJNE A,5FH, WT22 LJMP WT211 MOV A,5FH CJNE A,#00H, WT21 WT210
16、: MOV A,#05H ADD A,31H CJNE A,5FH, WT212WT211: MOV 32H,5FH CLR 7AH MOV DPTR,#7F2H MOV WDAT,5FH;#58H LCALL WFLASH LJMP GNJSWT212: JC FMCL LJMP WT211 WT22: JNC FMCL LJMP WT211SWTCH: CLR 7AH MOV DPTR,#7F6H MOV WDAT,26H;#58H LCALL WFLASH LJMP GNJSFMCL: SETB 7AH LJMP LOOP3 GN00: LJMP GN0 KJSGN1: JB 66H,
17、GN00 JB 67H, GN00 CLR 7AH INC R4 GNJS: CJNE R4,#00H, GNL MOV 2AH,#00H MOV 2CH,#00H LCALL Operation MOV 50H,#0FH LJMP LOOP3GNL: CJNE R4,#01H, GNH MOV 2AH,#03H MOV 2CH,#03H MOV 50H,#0AH MOV 78H,31H LCALL HEX_BCDBLOCK LJMP LOOP3GNH: CJNE R4,#02H, GNS MOV 2AH,#03H MOV 2CH,#05H MOV 50H,#0BH MOV 78H,32H L
18、CALL HEX_BCDBLOCK LJMP LOOP3 GNS: CJNE R4,#03H, GNFW MOV 2AH,#41H MOV 2CH,#09H MOV 50H,#05H JNB 35H, GNSa MOV 51H,#0CH MOV 52H,#0FH MOV 53H,#11H LJMP LOOP3GNSa: MOV 51H,#0CH MOV 52H,#0BH MOV 53H,#14H LJMP LOOP3 GNFW: MOV R4,#00H MOV 2AH,#00H MOV 2CH,#00H MOV 2DH,#00H ;MOV 51H,R6 LJMP GNJS KJSYW: JB
19、65H, LOOP35 JB 67H, LOOP35 SETB 66HJB 63H, KJSQH JNB 50H, KJSYW1 CLR 28H JB 51H, YW1 JB 52H, YW2 JB 53H, YW3 LJMP LOOP3KJSYW1: CPL 5EH MOV 2AH,#00H ;MOV 2CH,#00H JNB 5EH, KJSYW2SETB out SETB 7BH MOV 49H,#00H LJMP LOOP3KJSYW2: MOV 7BH,#0FFH CLR out CLR 7BH LJMP LOOP3YW1: MOV 2AH,#05H LJMP LOOP3YW2: M
20、OV 2AH,#09H LJMP LOOP3YW3: MOV 2AH,#03HLOOP35: LJMP LOOP3 KJSQH: CPL 35H JNB 35H, KJSQH1 MOV 51H,#0CH MOV 52H,#0FH MOV 53H,#11H LJMP LOOP3KJSQH1: MOV 51H,#0CH MOV 52H,#0BH MOV 53H,#14H LJMP LOOP3KJSZL: JB 63H, LOOP35 JB 65H, LOOP35 SETB 66H;67H JB 51H, GWDJ JB 52H, SWDJ JB 53H, BWDJ LJMP RH_TGWDJ: I
21、NC 53H MOV A,53H CJNE A,#0AH, LOOP35 MOV 53H,#00H LJMP LOOP3SWDJ: INC 52H MOV A,52H CJNE A,#0AH, LOOP35 MOV 52H,#00H LJMP LOOP3BWDJ: INC 51H MOV A,51H CJNE A,#01H, B555 MOV 51H,#01H LJMP LOOP3B555: MOV 51H,#00H LJMP LOOP3 RH_T: CPL 2AH LJMP LOOP3;*DELLY: MOV R7,#1FHMS2: MOV R6,#5FHMS1: DJNZ R6,MS1 D
22、JNZ R7,MS2 RET ;* WDT_R: CLR EA MOV WFEED1,#0A5H MOV WFEED2,#5AH SETB EA RET ;* T0ZD: PUSH Acc PUSH PSW CLR 75H SETB 77H SETB 72H CLR TCON.4 FW0: POP PSW POP Acc RETI ;* T1ZD: PUSH Acc PUSH PSWCLR TCON.7SETB 5DH MOV TH1,#00HMOV TL1,#01H CLR TCON.6 FW1: POP PSW POP Acc RETI ;*RTCI: PUSH Acc PUSH PSW ANL RTCCON,#63HINC 5BHCPL 55H;CLR 59H DJNZ 67H, SZ0 MOV 2DH,#00H MOV 2CH,#00H MOV 2AH,#00H MOV 22H,#03H MOV 67H,#26H CLR 25H CLR 73HSZ0: INC 45H