TMS320F28035 ADC采用内部参考源时,CPU内部温度采样正常;
代码如下:
// Useful definitions
#define FP_SCALE 32768 //Scale factor for Q15 fixed point numbers (2^15)
#define FP_ROUND FP_SCALE/2 //Added to Q15 numbers before converting to integer to round the number
// Amount to add to Q15 fixed point numbers to shift from Celsius to Kelvin
// (Converting guarantees number is positive, which makes rounding more efficient)
#define KELVIN 273
#define KELVIN_OFF FP_SCALE*KELVIN
// The folloing pointers to function calls are:
//Slope of temperature sensor (deg. C / ADC code). Stored in fixed point Q15 format.
#define getTempSlope() (*(int (*)(void))0x3D7E82)()
//ADC code corresponding to temperature sensor output at 0 deg. C
#define getTempOffset() (*(int (*)(void))0x3D7E85)()
//This function uses the reference data stored in OTP to convert the raw temperature
//sensor reading into degrees C
int16 GetTemperatureC(int16 sensorSample)
{
return ((sensorSample – getTempOffset())*(int32)getTempSlope() + FP_ROUND + KELVIN_OFF)/FP_SCALE – KELVIN;
}
//This function uses the reference data stored in OTP to convert the raw temperature
//sensor reading into degrees K
int16 GetTemperatureK(int16 sensorSample)
{
return ((sensorSample – getTempOffset())*(int32)getTempSlope() + FP_ROUND + KELVIN_OFF)/FP_SCALE;
}
当改为外部参考源时,CPU内部温度如何计算?
还是说CPU内部温度采样只能采用内部参考源?
user4938334:
回复 笨鸟:
请问改变参考电源后怎么确定TempSensorOffset 和TempSensorSlope