#include <STC12C5A60S2.h>
#include <stdio.h>
#include "temperature_display.h"
#include "LCD1602.h"
#include "DS18B20.h"
#include "key.h"
#include "delay.h"
sbit LED1=P1^0;
sbit LED3=P1^2;
sbit beep=P1^1;
sbit KEY1=P2^0;
sbit KEY2=P2^1;
sbit R=P3^2;
sbit R1=P3^3;
uchar Temp_Dis_Buff[17];
extern uchar Temp_Value[];
extern uint TL,HL;
void ture()
{
float temp=0.0;
EA=1;
EX1=1;
IT1=0;
Init();
LCD_Show_String(0,0," Current Temp ");
LCD_Show_String(1,0," Waiting..... ");
Read_Temperature();
delay_ms(1500);
while(1)
{
P1=0xff;
if(KEY1==0)
{
while(KEY1==0);
R1=0;
R=1;
}
if(KEY2==0)
{
while(KEY2==0);
R1=1;
R=0;
}
if(Read_Temperature())
{
temp=(int)(Temp_Value[1]<<8 | Temp_Value[0])*0.0625;
sprintf(Temp_Dis_Buff," TEMP:%5.1f\xdf\x43",temp);
LCD_Show_String(1,0,Temp_Dis_Buff);
}
delay_ms(500);
if(temp>=TL)
{
LED1=0;
beep=0;
delay_ms(500);
}
if(temp<=HL)
{
LED3=0;
beep=0;
delay_ms(500);
}
}
}
void ex1() interrupt 2
{
scanning();
}
|