STM32's internal temperature sensor
Introduction
1. STM32 has an internal temperature sensor, which can be used to measure the temperature (TA) of the CPU and its surroundings.
2. The temperature sensor is internally connected to the ADCx_IN16 input channel, which converts the voltage output by the sensor into a digital value.
3. The recommended sampling time for temperature sensor analog input is 17.1μs.
4. The temperature range supported by STM32's internal temperature sensor is -40~125 degrees. The accuracy is relatively poor, about ±1.5°C.
5. The internal temperature sensor is more suitable for detecting temperature changes, rather than measuring absolute temperature. If the absolute temperature needs to be measured, an external temperature sensor should be used.
Correspondence between ADC channels and pins
Calculation formula
T ( ℃ ) = ( V 25 − V a d c ) / A v g S l o p e + 25 T(℃)={(V_{25}-V_{adc})/Avg_Slope}+25 T(℃)=(V25−Vadc)/AvgSlope+2 5 In the
above formula:
V_25 represents the voltage value at 25 degrees (the classic is 1.43V)
Avg_Slope=The average slope of temperature and corresponding voltage curve (unit is mv/℃ or uv/℃) (typical value is 4.3Mv/℃).
Steps to turn on the internal temperature sensor
program
Related functions can be found under this file
Main program
Subroutine