|
|
void temp_convert(void)
{
negetiveflag=0;
negetiveflag=temp_h&0x80;
if(negetiveflag)
{
negetiveflag=1;
temp_h=~temp_h;
if(temp_l==0)
{
temp_h++;
}
temp_l=~temp_l+1;
}
temp_h<<=4;
temp_l>>=4;
temp_over=temp_h|temp_l;
tempalarm=temp_over;
if(negetiveflag==1)
{
tempalarm=tempalarm*(-1);
}
}
ds18b20溫度轉(zhuǎn)換這段程序誰能詳細(xì)說明一下怎么運行的,如果我想計算小數(shù)如何改動
|
|