单片机温湿度监控装置汇编语言源程序清单.docx

上传人:b****8 文档编号:10628119 上传时间:2023-02-22 格式:DOCX 页数:32 大小:19.44KB
下载 相关 举报
单片机温湿度监控装置汇编语言源程序清单.docx_第1页
第1页 / 共32页
单片机温湿度监控装置汇编语言源程序清单.docx_第2页
第2页 / 共32页
单片机温湿度监控装置汇编语言源程序清单.docx_第3页
第3页 / 共32页
单片机温湿度监控装置汇编语言源程序清单.docx_第4页
第4页 / 共32页
单片机温湿度监控装置汇编语言源程序清单.docx_第5页
第5页 / 共32页
点击查看更多>>
下载资源
资源描述

单片机温湿度监控装置汇编语言源程序清单.docx

《单片机温湿度监控装置汇编语言源程序清单.docx》由会员分享,可在线阅读,更多相关《单片机温湿度监控装置汇编语言源程序清单.docx(32页珍藏版)》请在冰豆网上搜索。

单片机温湿度监控装置汇编语言源程序清单.docx

单片机温湿度监控装置汇编语言源程序清单

温湿度监控装置汇编语言源程序清单.doc

;*************************************************

WDATDATA40H

RDATDATA41H

LdataDATA42H

HdataDATA43H

P0M1DATA84H

P0M2DATA85H

P1M1DATA91H

P1M2DATA92H

P2M1DATA0A4H

P2M2DATA0A5H

TRIMDATA96H

SSTATDATA0BAH

IEN0DATA0A8H

IEN1DATA0E8H

WDLDATA0C1H

WFEED1DATA0C2H

WFEED2DATA0C3H

WDCONDATA0A7H

FMCONDATA0E4H

FMDATADATA0E5H

FMADRLDATA0E6H

FMADRHDATA0E7H

SPSTATDATA0E1H

SPCTLDATA0E2H

SPDATDATA0E3H

RTCCONDATA0D1H

RTCHDATA0D2H

RTCLDATA0D3H

;定义FLASH控制命令字

;*************************************************

LOADEQU00H;加载数据

PROGEQU48H;编程

ERS_PROGEQU68H;擦除编程

ERS_SEQU71H;擦除扇区

ERS_PEQU70H;擦除页

AN1BITP1.5;按扭1

AN2BITP1.3;按扭2

AN3BITP1.2;按扭3

Read_PBITP1.4;读数据口

outBITP0.0;负载输出

;----变量定义区------

;*************************************************

FLAGEQU63H

U8comdataEQU64H

U8T_data_HEQU65H

U8T_data_LEQU66H

U8RH_data_HEQU6AH

U8RH_data_LEQU6BH

U8checkdataEQU6CH

U8tempEQU6DH

tempEQU6EH

;*************************************************

ORG0000H

AJMPINIT_0

ORG000BH

LJMPT0ZD

ORG001BH

LJMPT1ZD

ORG0023H

LJMPCYKZD

ORG0053H

LJMPRTCI

ORG0060H

DB0FCH

DB60H

DB0DAH

DB0F2H

DB66H

DB0B6H

DB0BEH

DB0E0H

DB0FEH

DB0F6H

DB1CH;L

DB6EH;H

DB00H;消隐

DB00H

DB00H

DB1AH;c

DB0BCH;G

DB3AH;o

DB7AH;d

DB2EH;h

DB9EH;E

;*************************************************

ORG0080H

INIT_0:

MOV22H,#03H

MOV25H,#00H

MOV2AH,#00H

MOV2DH,#00H

MOV2CH,#00H

MOV30H,#00H

MOV31H,#00H

MOV32H,#00H

MOV33H,#00H

MOV34H,#00H

MOV35H,#00H

MOV3DH,#35H

MOV42H,#09H

MOV43H,#01H

MOV45H,#00H

MOV46H,#00H

MOV47H,#00H

MOV48H,#00H

MOV49H,#00H

MOV4BH,#0FH

MOV4CH,#02H

MOV4DH,#0FH

MOV50H,#00H

MOV51H,#0BCH

MOV52H,#3AH

MOV53H,#3AH

MOV54H,#7AH

MOV55H,#00H

MOV5BH,#5

MOV5DH,#58H

MOVP0M1,#00H

MOVP0M2,#3DH

MOVP1M1,#20H

MOVP1M2,#03H

MOVP1,#0FFH

MOVTCON,#05H;;;;;;;#55H

MOVTMOD,#11H

MOVSCON,#00H;;;;;;;#10H

;MOVTL0,#0B4H

;MOVTH0,#3CH

MOVTL1,#88H

MOVTH1,#98H

MOVRTCL,#7FH

MOVRTCH,#70H

MOVRTCCON,#63H

MOVIEN0,#0DAH

INIT_2:

MOVAcc,WDCON

SETBAcc.2

MOVWDL,#0FFH

CLREA

MOVWDCON,Acc

MOVWFEED1,#0A5H

MOVWFEED2,#5AH

SETBEA

INIT_3:

MOV2EH,#00H

MOV2FH,#00H

MOVDPTR,#7F1H

LCALLRFLASH

MOV31H,RDAT

MOVDPTR,#7F2H

LCALLRFLASH

MOV32H,RDAT

MOVDPTR,#7F6H

LCALLRFLASH

MOV26H,RDAT

;*************************************************

MAIN:

CLR2AH;温度/湿度切换标志位

CLR58H;控制信号“开”辅助位

CLR59H;读取数据辅助位

SETB5AH;FLASH读写辅助位

CLR5BH;转换限制辅助位

CLR5CH;中继数据保存辅助位

CLR5DH;75ms中断延时辅助位

CLR5EH;手控开/关辅助位

CLR7BH;闪烁辅助位

CLRout;负载输出

SETBRead_P;;;;;;;;;;;;;;

MOVR4,#00H

LCALLWDT_R

LJMPLOOP0

KSM00:

LJMPKSM0

LOOP0:

MOVR1,#53H;;;;#51H

MOVR2,#20H;;;;#01H

MOVR3,#04H

LOOP1:

MOVDPH,#00H

MOVDPL,#60H

MOVA,@R1

MOVCA,@A+DPTR

JNB6FH,LOOP2

ADDA,#01H

CLR6FH

LOOP2:

MOVSBUF,A

MOVA,P0

ANLA,#03H

ORLA,R2

JNB55H,SSCL

JB7BH,SSCL0

JNB50H,SSCL

SSCL0:

ANLA,7BH

SSCL:

MOVP0,A

MOVA,R2

RRA;;;;;;;;;;RLA

MOVR2,A

ANLA,#3CH

CJNEA,#04H,GPPP

SETB6FH

GPPP:

JNBAN1,KSM00

JNBAN2,KSM00

JNBAN3,KSM00

JNB72H,ABC

ANL2EH,#00H

CLR72H

ABC:

JB59H,DEF

JB60H,DEF

LCALLRead_WS

SETB59H

LCALLOperation

DEF:

NOP

LOOP3:

JNB55H,LOOP4

JB7BH,XY5

JNB50H,LOOP4

JB51H,XY1

JB52H,XY2

JB53H,XY3

JB54H,XY6

JB56H,XY6

LOOP4:

LCALLDELLY

JB50H,GPPPP

JB67H,GPPPP

MOVA,R2

JBACC.3,GPPPPP

GPPPP:

NOP

GPPPPP:

NOP

LOOP5:

JB28H,LOOP6

JB60H,LOOP7

JB65H,LOOP7

LOOP6:

JNB29H,LOOP7

NOP

LOOP7:

DECR1;;;INCR1

DJNZR3,LOOP10

LCALLWDT_R

JNB72H,LOOP8

JB76H,JS

LOOP8:

JB28H,LOOP00

JB60H,LOOP00

JNB7DH,LOOP00

LOOP00:

LJMPLOOP0

LOOP10:

LJMPLOOP1

XY1:

MOV7BH,#0DFH

LJMPLOOP4

XY2:

MOV7BH,#0EFH

LJMPLOOP4

XY3:

MOV7BH,#0F7H

LJMPLOOP4

XY5:

MOV7BH,#0C3H

LJMPLOOP4

XY6:

MOV7BH,#0CFH

LJMPLOOP4

JS:

DJNZ5DH,LOOP00

JNB60H,LOOP00;;;;

CLR76H

MOV5DH,#25H

LJMPLOOP0

LJMPLOOP7

KSM0:

JB75H,LOOP30

JB76H,LOOP30

JB77H,KSM1

MOVTL0,#0EBH

MOVTH0,#0E0H

MOV67H,#26H

MOV5DH,#55H

MOV48H,#00H

MOV49H,#00H

CLR2FH

SETBTCON.4

SETB75H

LOOP30:

LJMPLOOP3

KSM1:

JB72H,KSM2

JB76H,LOOP30

KSM2:

;SETB70H

;SETB73H

SETB76H

JNBAN1,KJSGN

JNBAN2,KJSYW0

JNBAN3,KJSZL0

LJMPLOOP3

KJSZL0:

LJMPKJSZL

KJSYW0:

LJMPKJSYW

LJMPINIT_3

KJSGN:

JB60H,KJSGN10

JB50H,KJSGN10

SETB7EH

DJNZ22H,LOOP33

CLR67H

CLR66H

SETB60H

CLR28H

MOV22H,#03H

MOV2AH,#03H

MOV2CH,#03H

MOVR4,#01H

MOV78H,31H

LCALLHEX_BCDBLOCK

MOV50H,#0AH

LOOP33:

LJMPLOOP3

KJSGN10:

LJMPKJSGN1

GN0:

LCALLBCD_HEXBLOCK

JB61H,WT1

JB62H,WT2

JB63H,SWTCH

ANL2CH,#3FH

LJMPLOOP3

WT1:

MOVA,#7DH;#50H

CJNEA,5FH,WT11

WT110:

MOVA,#05H;;;;;;;;;;;;;;;;

ADDA,5FH

CJNEA,32H,WT112

WT111:

MOV31H,5FH

CLR7AH

MOVDPTR,#7F1H

MOVWDAT,5FH;;;;;#58H

LCALLWFLASH

LJMPGNJS

WT112:

JNCFMCL

LJMPWT111

WT11:

JCFMCL

MOVA,5FH

CJNEA,#00H,WT12

LJMPWT111

WT12:

JCFMCL

LJMPWT110

WT2:

MOVA,#7DH;;;;;

CJNEA,5FH,WT21

LJMPWT211

WT21:

JCFMCL

MOVA,#05H

ADDA,31H

CJNEA,5FH,WT22

LJMPWT211

MOVA,5FH

CJNEA,#00H,WT21

WT210:

MOVA,#05H

ADDA,31H

CJNEA,5FH,WT212

WT211:

MOV32H,5FH

CLR7AH

MOVDPTR,#7F2H

MOVWDAT,5FH;;;;;#58H

LCALLWFLASH

LJMPGNJS

WT212:

JCFMCL

LJMPWT211

WT22:

JNCFMCL

LJMPWT211

SWTCH:

CLR7AH

MOVDPTR,#7F6H

MOVWDAT,26H;;;;;#58H

LCALLWFLASH

LJMPGNJS

FMCL:

SETB7AH

LJMPLOOP3

GN00:

LJMPGN0

KJSGN1:

JB66H,GN00

JB67H,GN00

CLR7AH

INCR4

GNJS:

CJNER4,#00H,GNL

MOV2AH,#00H

MOV2CH,#00H

LCALLOperation

MOV50H,#0FH

LJMPLOOP3

GNL:

CJNER4,#01H,GNH

MOV2AH,#03H

MOV2CH,#03H

MOV50H,#0AH

MOV78H,31H

LCALLHEX_BCDBLOCK

LJMPLOOP3

GNH:

CJNER4,#02H,GNS

MOV2AH,#03H

MOV2CH,#05H

MOV50H,#0BH

MOV78H,32H

LCALLHEX_BCDBLOCK

LJMPLOOP3

GNS:

CJNER4,#03H,GNFW

MOV2AH,#41H

MOV2CH,#09H

MOV50H,#05H

JNB35H,GNSa

MOV51H,#0CH

MOV52H,#0FH

MOV53H,#11H

LJMPLOOP3

GNSa:

MOV51H,#0CH

MOV52H,#0BH

MOV53H,#14H

LJMPLOOP3

GNFW:

MOVR4,#00H

MOV2AH,#00H

MOV2CH,#00H

MOV2DH,#00H

;MOV51H,R6

LJMPGNJS

KJSYW:

JB65H,LOOP35

JB67H,LOOP35

SETB66H

JB63H,KJSQH

JNB50H,KJSYW1

CLR28H

JB51H,YW1

JB52H,YW2

JB53H,YW3

LJMPLOOP3

KJSYW1:

CPL5EH

MOV2AH,#00H

;MOV2CH,#00H

JNB5EH,KJSYW2

SETBout

SETB7BH

MOV49H,#00H

LJMPLOOP3

KJSYW2:

MOV7BH,#0FFH

CLRout

CLR7BH

LJMPLOOP3

YW1:

MOV2AH,#05H

LJMPLOOP3

YW2:

MOV2AH,#09H

LJMPLOOP3

YW3:

MOV2AH,#03H

LOOP35:

LJMPLOOP3

KJSQH:

CPL35H

JNB35H,KJSQH1

MOV51H,#0CH

MOV52H,#0FH

MOV53H,#11H

LJMPLOOP3

KJSQH1:

MOV51H,#0CH

MOV52H,#0BH

MOV53H,#14H

LJMPLOOP3

KJSZL:

JB63H,LOOP35

JB65H,LOOP35

SETB66H;;;;;;;;;;;;67H

JB51H,GWDJ

JB52H,SWDJ

JB53H,BWDJ

LJMPRH_T

GWDJ:

INC53H

MOVA,53H

CJNEA,#0AH,LOOP35

MOV53H,#00H

LJMPLOOP3

SWDJ:

INC52H

MOVA,52H

CJNEA,#0AH,LOOP35

MOV52H,#00H

LJMPLOOP3

BWDJ:

INC51H

MOVA,51H

CJNEA,#01H,B555

MOV51H,#01H

LJMPLOOP3

B555:

MOV51H,#00H

LJMPLOOP3

RH_T:

CPL2AH

LJMPLOOP3

;*************************************************

DELLY:

MOVR7,#1FH

MS2:

MOVR6,#5FH

MS1:

DJNZR6,MS1

DJNZR7,MS2

RET

;*************************************************

WDT_R:

CLREA

MOVWFEED1,#0A5H

MOVWFEED2,#5AH

SETBEA

RET

;*************************************************

T0ZD:

PUSHAcc

PUSHPSW

CLR75H

SETB77H

SETB72H

CLRTCON.4

FW0:

POPPSW

POPAcc

RETI

;*************************************************

T1ZD:

PUSHAcc

PUSHPSW

CLRTCON.7

SETB5DH

MOVTH1,#00H

MOVTL1,#01H

CLRTCON.6

FW1:

POPPSW

POPAcc

RETI

;*************************************************

RTCI:

PUSHAcc

PUSHPSW

ANLRTCCON,#63H

INC5BH

CPL55H

;CLR59H

DJNZ67H,SZ0

MOV2DH,#00H

MOV2CH,#00H

MOV2AH,#00H

MOV22H,#03H

MOV67H,#26H

CLR25H

CLR73H

SZ0:

INC45H

MOVA,45H

CJNEA,#03H,FWR

MOV45H,#00H

CLR59H

FWR:

POPPSW

POPAcc

RETI

;*************************************************

CYKZD:

PUSHAcc

PUSHPSW

ANLSCON,#0FCH

NOP

POPPSW

POPAcc

RETI

;写字节数据

;*************************************************

WFLASH:

CLREA

MOVFMCON,#LOAD

MOVFMADRH,DPH

MOVFMADRL,DPL

MOVFMDATA,WDAT;;;

MOVFMCON,#ERS_PROG;

MOVA,FMCON

ANLA,#0FH

SETB5AH

JZWFLASHF

CLR5AH

WFLASHF:

SETBEA

RET

;读字节数据

;*************************************************

RFLASH:

CLRA

MOVCA,@A+DPTR

MOVRDAT,A

RET

;采集温湿度数据

;*************************************************

Read_WS:

;--------------------------------

;主机拉低总线,延时500us

CLRRead_P

MOVA,#1

LCALLDelay

;LCALLDelay

;LCALLDelay

LCALLDelay

LCALLDelay

SETBRead_P

;延时40us

LCALLDelay_10us

LCALLDelay_10us

LCALLDelay_10us

LCALLDelay_10us

;检测从机是否响应,无响应则跳出

JBRead_P,RH_END

MOVFLAG,#0

LOOPA:

INCFLAG

MOVA,FLAG

JBRead_P,LOOPA_END;为高电平则跳出

CJNEA,#0,LOOPA

LJMPRH_END

LOOPA_END:

MOVFLAG,#0

LOOPB:

INCFLAG

MOVA,FLAG

JNBRead_P,LOOPB_END;为低电平则跳出

CJNEA,#0,LOOPB

LJMPRH_END

LOOPB_END:

;进入数据接收阶段

LCALLRead

MOVU8RH_data_H,U8comdata;

LCALLRead

MOVU8RH_data_L,U8comdata;

LCALLRead

MOVU8T_data_H,U8comdata;

LCALLRead

MOVU8T_data_L,U8comdata;

LCALLRead

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 销售营销

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1