电子设计报告
} }
dat >>= 1; delayxus(1);
/**************************** 读取温度 返回温度值
*****************************/ uchar ReadTemperature(void) {
unsigned int a = 0; unsigned int b = 0; unsigned int t = 0; ds18b20_Reset();
ds18b20_WriteByte(0xCC); ds18b20_WriteByte(0x44); ds18b20_Reset();
ds18b20_WriteByte(0xCC); ds18b20_WriteByte(0xBE); a = ds18b20_ReadByte(); b = ds18b20_ReadByte(); b<<= 4;
b+=(a&0xf0)>>4 ;
t=b; }
/**************报警*****************************/ /*************延时************************/ void delayy(uchar y) {
return (t);