PIC16F6278(或PIC类)与DS18B20通信的程序
; Program 1820.asm
;
; Performs temperature measurment. No addressing.
;
; Note that in this routine, the results of the measurement are written
; to a data buffer beginning at data location 18H for later display or
; other processing.
;
; 12C509 DS1820
; GPIO.0 (term 7) ------------------------------ DQ (term 2)
;
LIST p=12C509A
#include
__CONFIG _CP_OFF & _WDT_OFF & _MCLRE_OFF & _IntRC_OSC
CONSTANT DATA_PIN=0
CONSTANT BASE_VAR=07H
CONSTANT DATA_BUFF=18H
CONSTANT BUFF_SIZE=7
PIN_DIRS EQU BASE_VAR+0
N EQU BASE_VAR+1
_N EQU BASE_VAR+2 ; these vars used by the
O_BYTE EQU BASE_VAR+3 ; common 1-wire routines
I_BYTE EQU BASE_VAR+4
LOOP3 ……