#include < reg51
h > #include < intrins
h > #define uchar unsigned char #define uint unsigned int sbit DQ = P2^7 ; //定义 DS18B20 端口 DQ void reset(); //DS18B20 复位函数 void write_byte(uchar val); //DS18B20 写命令函数 uchar read_byte(void); //DS18B20 读 1 字节函数 void read_temp(); //温度读取函数 void work_temp(); //温度数据处理函数 sbit BEEP=P2^5 ; //蜂鸣器驱动线 bit presence ; sbit LCD_RS = P3^5 ; sbit LCD_RW = P3^6 ; sbit LCD_EN = P3^7 ; uchar code cdis1[ ] = {" SETTEMP: 50
C "} ; uchar code cdis2[ ] = {" TESTTEMP:
C "} ; uchar code cdis3[ ] = {" DS18B20 ERR0R "} ; uchar code cdis4[ ] = {" PLEASE CHECK "} ; unsigned char data temp_data[2] = {0x00,0x00} ; unsigned char data display[5] = {0x00,0x00,0x00,0x00,0x00} ; unsigned char code ditab[16] = {0x00,0x01,0x01,0x02,0x03,0x03,0x04,0x05,0x06,0x06,0x07,0x08,0x08,0x09,0x09}