看到一位大俠的貼子,地址如下:
摘要部分如下, unsigned chardis[]={0x00,0x00,0x00,0x00,0x00,0x00};//顯示數據 unsigned char TemL; unsigned char TemLH; unsigned char TemLL; unsigned char TemH; unsigned long Tem; bit TempS;
TemL=r_18b20(); //低字節 TemH=r_18b20(); //高字節
TemLH=TemL>>4; 低字節的4位整數 TemLL=TemL&0x0F; 低字節的4位小數 Tem=(TemH*16 + TemLH + TemLL*0.0625)*10000;
TemH*16相當于TemH右移4位,高字節的4位有效的整數位,
Tem=(TemH*16 + TemLH + TemLL*0.0625)*10000;這一句始終想不明白,為什么只有小數部分乘以0。0625?
|