標(biāo)題:
關(guān)于ds18b20讀的問題
[打印本頁]
作者:
放生
時間:
2013-12-13 09:31
標(biāo)題:
關(guān)于ds18b20讀的問題
為什么讀程序是這樣的?最后返回的值不就是0xff嗎?如果是這樣,何必寫這么多呢?直接返回0xff不就好了?
((我是新手,請大家見諒……))
uchar read_dsdat()
{
uhar dstemp,i;
for(i=0;i<8;i--)
{
DQ=0;
delay(1);
DQ=1;
delay(2);
dstemp>>=1;
if(DQ==1)
{
dstemp|=0x80;
}
delay(20);
DQ=1;
}
return dstemp;
}
作者:
放生
時間:
2013-12-13 10:20
求回復(fù)啊
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1