Board logo

标题: 接着 [打印本页]

作者: yaohaifeng    时间: 2006-5-23 10:31     标题: 接着

DEL:     MOV   R5,#02      ;为演示方便,人为插入的延时
DEL01:   MOV   R6,#200
DEL02:   MOV   R7,#200
         DJNZ  R7,$
         DJNZ  R6,DEL02
         DJNZ  R5,DEL01
         RET


BIN_BCD:  MOV  B,#10
          DIV  AB
          RET
 ;---------------------(ds18b20) 访问子程序,时序参见TRANSDATA.PDF文件----------------------------
DS_hart_RST:CLR   DS18B20                      ;总线复位
            MOV   R6,#250                      ;>DELAY 480US
            DJNZ  R6,$
            setb  ds18B20
            MOV   R6,#40                       ;>DELAY 60US
            DJNZ  R6,$
            mov   c,dS18B20
            MOV   R6,#250                      ;>DELAY 480US
            DJNZ  R6,$
            setb  DS18B20
            RET


DS_hart_RD_BYTE:                               ;读取一字节数据
            MOV   R5,#08H
RD_HART_BYTE_LP: 
            NOP
            NOP   
            CLR   DS18B20
            NOP
            NOP
            SETB  DS18B20
            MOV   R6,#06
            DJNZ  R6,$                         ;<DELAY 15US
            MOV   C,DS18B20
            RRC   A
            MOV   R6,#40                       ;>DELAY  60US
            DJNZ  R6,$
            DJNZ  R5,RD_HART_BYTE_LP
            RET


DS_HART_WR_BYTE:                              ;写入一字节指令
            MOV   R5,#08H
            CLR   C
WR_HART_BYTE_LP:
            nop
            nop
            CLR   DS18B20
            NOP
            NOP      
            RRC     A
            MOV   R6,#06
            DJNZ  R6,$
            setb  ds18B20
            MOV   DS18B20,C
            MOV   R6,#40                      ;>DELAY 60US
            DJNZ  R6,$
            SETB  DS18B20
            DJNZ  R5,WR_HART_BYTE_LP
            RET


作者: vincent    时间: 2006-5-23 10:35

建议你重新发帖,帖在一个帖子里面,方便别人给你浏览




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