/*********************************************************************
* @fn TempSensor_Volt_To_Temper
*
* @brief Internal Temperature Sensor Voltage to temperature.
*
* @param Value - Voltage Value(mv).
*
* @return Temper - Temperature Value.
*/
s32 TempSensor_Volt_To_Temper(s32 Value)
{
s32 Temper, Refer_Volt, Refer_Temper;
s32 k = 43;
Refer_Volt = (s32)((*(u32 *)0x1FFFF720) & 0x0000FFFF);
Refer_Temper = (s32)(((*(u32 *)0x1FFFF720) >> 16) & 0x0000FFFF);
Temper = Refer_Temper - ((Value - Refer_Volt) * 10 + (k >> 1)) / k;
return Temper;
}
这个读取单片机内部温度,执行上感觉太耗时了,这个能再优化一下吗?