R01UH0823EJ0100 Rev.1.00
Page 1633 of 1823
Jul 31, 2019
RX23W Group
46. Temperature Sensor (TEMPSA)
46.3
Using the Temperature Sensor
The temperature sensor outputs a voltage which varies with the temperature. The user can obtain the temperature
surrounding the MCU using the 12-bit A/D converter to convert this voltage into a digital value.
46.3.1
Before Using the Temperature Sensor
Perform a calibration of the temperature sensor as shown below. The voltage output by the temperature sensor is
proportional to the temperature, which can be calculated according to the formula below.
Formula for the temperature characteristic:
T = (Vs – V1)/Slope + T1
T: Measured temperature (°C)
Vs: Voltage output by the temperature sensor when the temperature is measured (V)
T1: Sample temperature measurement at first point (°C)
V1: Voltage output by the temperature sensor when T1 is measured (V)
T2: Sample temperature measurement at second point (°C)
V2: Voltage output by the temperature sensor when T2 is measured (V)
(V2 – V1)/(T2 – T1) = Slope: Temperature gradient of the temperature sensor (V/°C)
Characteristics vary from sensor to sensor. Therefore, it is recommended that two different sample temperatures are
measured.
Use the 12-bit A/D converter to measure the voltage V1 output by the temperature sensor at temperature T1.
Again, using the 12-bit A/D converter, measure the voltage V2 output by the temperature sensor at a different
temperature T2. Obtain the temperature gradient (Slope = (V2 – V1)/(T2 – T1)) from these results.
Subsequently, obtain temperatures by substituting the slope into the formula for the temperature characteristic (T = (Vs –
V1)/Slope + T1).
If you are using the temperature gradient given in
section 51, Electrical Characteristics
measure the voltage V1 output by the temperature sensor at temperature T1, and then calculate the temperature
characteristic by using the formula below.
However, this method produces less accurate temperatures than measurement at two points.
T = (Vs – V1)/Slope + T1
In this MCU, the TSCDRH and TSCDRL registers store the temperature value (CAL88) of the temperature sensor
measured under the condition of Ta = Tj = 88°C and AVCC0 = VREFH0 = 3.3 V. By using this value as the sample
measurement result at the first point, preparation before using the temperature sensor can be omitted.
This measured value CAL
88
can be calculated as follows:
CAL
88
= (TSCDRH register value << 8) + TSCDRL register value
If V1 is calculated from CAL
88
,
V1 = 3.3 × CAL
88
/4096 [V]
Using this, the measured temperature can be calculated according to the formula below.
T = (Vs – V1)/Slope + 88 [°C]