
Rev. 1.00
167 of 486
July 31, 2018
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F50231/HT32F50241
12
Analog to Digital Converter (ADC)
Sampling Time Setting
The conversion channel can be programmed the sampling time according to the input resistance of
the input voltage source. This sampling time must be enough for the input voltage source to charge
the internal sample and hold capacitor of the converter to the input voltage level. By modifying
the ADST [7:0] bits in the ADCSTR register, the sampling time of the analog input signal can be
determined.
The total conversion time (T
conv
) is calculated using the following formula:
T
conv
= T
Sampling
+ T
Latency
Where the minimum sampling time T
Sampling
= 1.5 cycles (when ADST[7:0] = 0) and the minimum
channel conversion latency T
Latency
= 12.5 cycles.
Example:
With the A/D Converter clock CK_ADC = 14 MHz and a sampling time = 1.5 cycles:
T
conv
= 1.5 + 12.5 = 14 cycles = 1 μs
Data Format
The ADC conversed result can be read in the ADCDR register and output data format which is
shown as following Table 24.
Table 24. Data Format in ADCDR [15:0]
Description
ADCDR Register Data Format
Right aligned
“0_0_0_0_d11_d10_d9_d8_d7_d6_d5_d4_d3_d2_d1_d0”
Analog Watchdog
The A/D converter includes a watchdog function to monitor the converted data. There are two
kinds of thresholds for the watchdog monitor function, known as the watchdog lower threshold
and watchdog upper threshold, which are specified by the ADLT bit field and ADUT bit field in the
ADCTR register respectively. The watchdog monitor function is enabled by setting the watchdog
upper and lower threshold monitor function enable bits, ADWUE and ADWLE, in the watchdog
control register ADCWCR. The channel to be monitored can be specified by configuring the
ADWCH and ADWALL bits. When the converted data is less or higher than the lower or upper
threshold, as defined by the ADLT bit field and ADUT bit field in the ADCTR register respectively,
the watchdog lower or upper threshold interrupt raw flags, ADIRAWL or ADIRAWU in the
ADCIRAW register, will be asserted if the watchdog lower or upper threshold monitor function
is enabled. If the lower or upper threshold interrupt raw flag is asserted and the corresponding
interrupt is enabled by setting the ADIEL or ADIEU bit in the ADCIER register, the A/D watchdog
lower or upper threshold interrupt will be generated.