void LM75A_Temp(void)
{
uint8_t Temp_Data[2]={0};
uint16_t Temp;
I2C_BurstRead(HW_I2C0, 0x48, 0x00, 0, Temp_Data, 2);
Temp=(uint16_t)Temp_Data[0];
Temp=(Temp<<8|Temp_Data[1])>>5;
if(!(Temp_Data[0]&0x80))
{
L75_Temp=Temp*0.125;
printf("当前温度:+%.3f度\r\n",L75_Temp);
}
else
{
L75_Temp=(0x800-Temp)*0.125;
printf("当前温度:-%.3f度\r\n",L75_Temp);
}
}
|