#include "hardware.h"
#include "DS18B20.c"
uchar word[]="0123456789.";
uchar p[7];
/*
* 延时
*/
void delay(uint n)
{
while (n--);
}
/*
* UART初始化
* 波特率:2400
*/
void UART_init(void)
{
SCON = 0x50; // 10位uart,允许串行接受
TMOD = 0x20; // 定时器1工作在方式2(自动重装)
TH1 = 0xF3;
TL1 = 0xFD;
TR1 = 1;
}
/*
* UART 发送一字节
*/
void UART_send_byte(uchar dat)
{
SBUF = dat;
while (TI == 0);
TI = 0;
}
/*
* UART 发送字符串
*/
void UART_send_string(uchar *buf)
{
while (*buf != '')
{
UART_send_byte(*buf++); delay(2000);
}
}
main()
{
//uint sign;
uint i;
UART_init();
while (1)
{
convert_T(); read_T();dis_T();
p[0]=flag[k];
p[1]= word[ds[3]];
p[2]= word[ds[2]];
p[3]= word[10];
p[4]= word[ds[1]];
p[5]= word[ds[0]];
p[6]= '';
UART_send_string(p);
if(fire==0)
UART_send_string("a");
for(i=0;i