Board logo

标题: 继续 [打印本页]

作者: yaohaifeng    时间: 2006-5-23 10:31     标题: 继续

GET_TEMP:    LCALL  DS_HART_RST
             MOV    A,#0CCH
             LCALL  DS_HART_WR_BYTE
             MOV    A,#44H
             LCALL  DS_HART_WR_BYTE
             SETB   DS18B20
             lcall  del                ;WAIT 750ms
             lcall  del
             LCALL  DS_HART_RST
             MOV   A,#0CCH
             LCALL  DS_HART_WR_BYTE
             MOV   A,#0BEH
             LCALL  DS_HART_WR_BYTE
             MOV   R4,#02
             MOV   R1,#BUFF_1820L
SUB_HART_LP1CALL  DS_HART_RD_BYTE   ;读18B20低BYTE(BUFF_1820L)
             MOV   @R1,A
             INC   R1                 ;读18B20高BYTE(BUFF_1820H)
             DJNZ  R4,SUB_HART_LP1
             setb   ds18B20
             MOV   A,BUFF_1820L
             ANL   A,#0FH
             CJNE  A,#10,JUD_HART_INC1 ;四舍五入
             JMP   JUD_HART_EQU
JUD_HART_INC1:JC   JUD_HART_EQU
              MOV  A,BUFF_1820L
              ADD  A,#10H
              MOV  BUFF_1820L,A
              MOV  A,BUFF_1820H
              ADDC A,#00H
              MOV  BUFF_1820H,A 
JUD_HART_EQU:MOV   A,BUFF_1820L      
             ANL   A,#0F0H
             SWAP  A
             MOV   BUFF_1820L,A
             MOV   A,BUFF_1820H
             ANL   A,#0FH
             SWAP  A
             ADD   A,BUFF_1820L
             CJNE  A,#85,END_HART
             RET
END_HART:    MOV   TEMP,A
             RET




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0