GD32A50x User Manual
275
data of routine sequence for conversion of more than one channel. The ADC generates a
DMA request at the end of conversion of a routine channel. When this request is received,
the DMA will transfer the converted data from the ADC_RDATA register to the destination
location which is specified by the user.
Note:
ADC1 has no DMA request.
14.4.11.
ADC internal channels
When the TSVEN bit in ADC_CTL1 register is set, the temperature sensor channel
(ADC_IN16) 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
t
s_temp
µs (please refer to the datasheet). When this sensor is not in use, it can be set in power
down mode by resetting the TSVEN bit.
The output voltage of the temperature sensor changes linearly with temperature. Due to the
diversification of production process, the deviation of the temperature change curve is
different on chip to chip (refer to the device datasheet for more information).
To use the temperature sensor:
1.
Configure the ADC clock(not greater than 5MHz).
2.
Configure the conversion sequence (ADC_IN16) and the sampling time(t
s_temp
μs)
for the channel.
3.
Enable the temperature sensor by setting the TSVEN bit in the ADC control register
1 (ADC_CTL1).
4.
Start the ADC conversion by setting the ADCON bit (or by trigger).
5.
Read the resulting temperature data(V
temperature
) in the ADC data register, and get
the temperature using the following formula:
Temperature (°C) = ((V
temperature
– V
30
) / Avg_Slope) + 30
V
temperature
: The output voltage of temperature sensor.
V
30
: The output voltage of internal temperature sensor at 30°C. The ADC conversion
results of the temperature sensor corresponding to
30°C were calibrated during chip
production(VDDA=5.0V). The factory-calibrated offset value is stored in the read-
only area of flash, and
refers to electrical characteristics section of device datasheet.
Avg_Slope: Average slope for curve between temperatures vs. the output voltage of
internal temperature sensor, refers to electrical characteristics section of device
datasheet.
Note
:
1)
After the temperature sensor is enabled, it is necessary to wait for at least 3 ADC
sampling cycles before the ADC conversion code value is considered valid, and the
first 3 conversion data should be discarded;
2)
The sampling accuracy of temperature sensor can be improved by means of