2025-05-19 8:29 PM
I used the example code in RM, and room temperature is arround 31℃,the ADC value is 10644, calculated temperaure is 4127, does it means 41.27℃?what will happen if minus temperature?
/* Temperature sensor calibration value address */
#define TEMP130_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FF8007E))
#define TEMP30_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FF8007A))
#define VDD_CALIB ((uint16_t) (300))
#define VDD_APPLI ((uint16_t) (330))
int32_t ComputeTemperature(int32_t measure)
{
int32_t temperature;
temperature = ((measure * VDD_APPLI / VDD_CALIB) - (int32_t) *TEMP30_CAL_ADDR ) ;
temperature = temperature * (int32_t)(130 - 30);
temperature = temperature / (int32_t)(*TEMP130_CAL_ADDR - *TEMP30_CAL_ADDR);
temperature = temperature + 30;
return(temperature);
}
Solved! Go to Solution.
2025-05-19 8:34 PM
> does it means 41.27℃?
Yes. A +10 C difference from ambient is reasonable. It is measuring the temperature inside the chip, not ambient. Expect an overall accuracy of +/- 5 C or so. The calibration temperatures are not exact, and the sensor is not perfectly linear. It will be more accurate at measuring relative temperature changes.
> what will happen if minus temperature?
Then the result will be negative. For example, -1000 for -10.00 C
2025-05-19 8:34 PM
> does it means 41.27℃?
Yes. A +10 C difference from ambient is reasonable. It is measuring the temperature inside the chip, not ambient. Expect an overall accuracy of +/- 5 C or so. The calibration temperatures are not exact, and the sensor is not perfectly linear. It will be more accurate at measuring relative temperature changes.
> what will happen if minus temperature?
Then the result will be negative. For example, -1000 for -10.00 C
2025-05-19 9:01 PM
Thanks.