/*===================================================================
Main Program
====================================================================*/
//从DS18B20数字温度传感器读取的温度值。
void delay (unsigned int count)
{
unsigned int i;
while (count)
{
i =200;
while (i>0) i--;
count--;
}
}
void tmreset (void) // 发送复位和初始化
{
unsigned int i;
P30 = 0;
i = 103;
while (i>0) i--; // 延时
P30 = 1;
i = 4;
while (i>0) i--;
}
bit tmpread (void) // 读取数据的一位
{
unsigned int i;
bit dat;
P30 = 0; i++;
P30 = 1; i++; i++; //延时
dat = P30;
i = 8; while (i>0) i--; // 延时
return (dat);
}