GD32F20x User Manual
266
14.4.12.
Temperature sensor, and internal reference voltage V
REFINT
When the TSVREN bit of ADC_CTL1 register is set, the temperature sensor channel
(ADC0_CH16) and V
REFINT
channel (ADC0_CH17) is enabled. The temperature sensor can
be used to measure the ambient temperature of the device. The sensor output voltage can
be converted into a digital value by ADC. The sampling time for the temperature sensor is
recommended to be set to at least 17.1 µs. When this sensor is not in use, it can be put in
power down mode by resetting the TSVREN bit.
The output voltage of the temperature sensor changes linearly with temperature. Because
there is an offset, which is up to 45 °C and varies from chip to chip due to process variation,
the internal temperature sensor is more suited for applications that detect temperature
variations instead of absolute temperature. When it is used to detect accurate temperature,
an external temperature sensor part should be used to calibrate the offset error.
The internal voltage reference (V
REFINT
) provides a stable (bandgap) voltage output for the
ADC and Comparators. V
REFINT
is internally connected to the ADC0_CH17 input channel.
Software procedure for use the temperature sensor:
1.
Configure the conversion sequence(ADC_IN16) and the sampling time(
17.1μs) for the
channel.
2.
Enable the temperature sensor by setting the TSVREN bit in the ADC control register 1
(ADC_CTL1).
3.
Start the ADC conversion by setting the ADCON bit (or by external trigger).
4.
Read the resulting temperature data(V
temperature
) in the ADC data register, and get the
temperature using the following formula:
Temperature (°C) = {(V
25
– V
temperature
(digit)) / Avg_Slope} + 25.
V
25
: V
temperature
value at 25°C, the typical value is 1.43 V.
Avg_Slope: Average Slope for curve between Temperature vs. V
temperature
, the typical
value is 4.3 mV/°C.
14.4.13.
Programmable resolution (DRES) - fast conversion mode
It is possible to obtain faster conversion time (t
ADC
) by reducing the ADC resolution.
The resolution can be configured to be either 12, 10, 8, or 6 bits by programming the
DRES[1:0] bits in the ADC_OVSAMPCTL register. Lower resolution allows faster conversion
time for applications where high data precision is not required. The DRES[1:0] bits must only
be changed when the ADCON bit is reset. Lower resolution reduces the conversion time
needed for the successive approximation steps as shown in
Summary of Contents for GD32F20 Series
Page 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Page 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Page 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Page 385: ...GD32F20x User Manual 385 ...
Page 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...