#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit DQ=P3^3;
sbit BEEP=P3^7;
sbit LCD_RS=P2^0;
sbit LCD_RW=P2^1;
sbit LCD_EN=P2^2;
sbit K1=P3^5;
uchar code Temp_Disp_Title[]={" Current Temp : "};
uchar Current_Temp_Display_Buffer[]={"TEMP: "};
uchar code Alarm_Temp[]={"ALARM TEMP Hi Lo"};
uchar Alarm_HI_LO_STR[]={"Hi: Lo: "};
uchar code df_Table[]={0,1,1,2,3,3,4,4,5,6,6,7,8,8,9,9};
char Alarm_Temp_HL[2]={20,10};
uchar CurrentT=0;
uchar Temp_Value[]={0x00,0x00};
uchar Display_Digit[]={0,0,0,0};
bit HI_Alarm=0,LO_Alarm=0;
bit DS18B20_IS_OK=1;
uint Time0_Count=0;
void DelayMS(uint x){
uchar i;
while(x--)for(i=0;i<120;i++);
}
uchar Read_LCD_State(){
uchar state;
LCD_RS=0;LCD_RW=1;LCD_EN=1;DelayMS(1);state=P0;LCD_EN=0;DelayMS(1);
return state;
}
void LCD_Busy_Wait(){
while((Read_LCD_State()&0x80)==0x80);
DelayMS(5);
}
void Write_LCD_Command(uchar cmd){
LCD_Busy_Wait();
LCD_RS=0;LCD_RW=0;LCD_EN=0;P0=cmd;LCD_EN=1;DelayMS(1);LCD_EN=0;
}
void Write_LCD_Data(uchar dat){
LCD_Busy_Wait();
LCD_RS=1;LCD_RW=0;LCD_EN=0;P0=dat;LCD_EN=1;DelayMS(1);LCD_EN=0;
}
void DelayXus(int x)
{
uchar i;
while(x--)for(i=0;i<200;i++);
}
//ÑÓʱ
void Delay(uint num){
while(--num);
}
uchar Init_DS18B20(){
uchar status;
DQ=1;Delay(8);
DQ=0;Dela