#define uchar unsigned char
#define uint unsigned int
sbit DQ=P1^6;//ds18b20与单片机连接口
sbit RS=P1^0;
sbit RW=P1^1;
sbit EN=P1^2;
sbit BEEP=P1^7;
//unsigned char code str1[]={" "};
unsigned char code str2[]={" "};
uchar data disdata[5];
uint tvalue;//温度值
uchar tflag;//温度正负标志
uchar hshi,hge,Th=25;
uchar Tl=20,lshi,lge;
sbit s1=P2^3; //功能
sbit s2=P2^2; //加
sbit s3=P2^1; //减
sbit gnd=P2^5;
uchar s1num;
/*************************lcd1602程序**************************/
void delay1ms(unsigned int ms)//延时1毫秒(不够精确的)
{unsigned int i,j;
for(i=0;i
}
void wr_com(unsigned char com)//写指令//
{ delay1ms(1);
RS=0;
RW=0;
EN=0;
P0=com;
delay1ms(1);
EN=1;
delay1ms(1);
EN=0;
}
void wr_dat(unsigned char dat)//写数据//
{ delay1ms(1);;
RS=1;
RW=0;
EN=0;
P0=dat;
delay1ms(1);
EN=1;
delay1ms(1);
EN=0;
}
void lcd_init()//初始化设置//
{delay1ms(15);
wr_com(0x38);delay1ms(5);
wr_com(0x80);delay1ms(5);
wr_com(0x01);delay1ms(5);
wr_com(0x06);delay1ms(5);
wr_com(0x0c);delay1ms(5);
}
void display(unsigned char *p)//显示//
{
while(*p!='