*
输
出
: 1:
未检测到
DS18B20
的存在,
0:
存在
********************************************************************/
u8 ds18b20_check(void)
{
u8
time_temp
=0;
while(DS18B20_PORT&&
time_temp
<20)
//
等待
DQ
为低电平
{
time_temp
++;
delay_10us(1);
}
if(
time_temp
>=20)return 1;
//
如果超时则强制返回
1
else
time_temp
=0;
while((!DS18B20_PORT)&&
time_temp
<20)
//
等待
DQ
为高电平
{
time_temp
++;
delay_10us(1);
}
if(
time_temp
>=20)return 1;
//
如果超时则强制返回
1
return 0;
}
/*****
附录-861字.docx