GD32F10x User Manual
217
is set. In this mode, the ADC performs a short sequence of n conversions (n
does not exceed
8
) which is a part of the conversions selected in the ADC_RSQ0~ADC_RSQ2 registers. The
value of n is configured by the DISNUM[2:0] bits in the ADC_CTL0 register. When the
corresponding software trigger or external trigger is active, the ADC samples and converts
the next n channels configured in the ADC_RSQ0~ADC_RSQ2 registers until all the channels
of
routine sequence are done. The EOC will be set after every circle of the routine sequence.
An interrupt will be generated if the EOCIE bit is set.
Figure 11-6. Discontinuous operation mode
CH2
CH1
CH5
CH7
CH11
CH16
CH2
CH1
· · ·
EOC
One circle of routine sequence, RL=7, DISNUM=2
Sample
Convert
CH12
CH17
CH5
Routine
trigger
Software procedure for discontinuous operation mode on a routine sequence:
1.
Set the DISRC bit in the ADC_CTL0 register and the DMA bit in the ADC_CTL1 register.
2.
Configure DISNUM[2:0] bits in the ADC_CTL0 register.
3.
Configure ADC_RSQx and ADC_SAMPTx registers.
4.
Configure ETERC and ETSRC bits in the ADC_CTL1 register if in need.
5.
Prepare the DMA module to transfer data from the ADC_RDATA (refer to the spec of the
DMA
module).
6.
Set the SWRCST bit, or generate an external trigger for the
routine sequence.
7.
Repeat step6 if in need.
8.
Wait the EOC flag to be set.
9.
Clear the EOC flag by writing 0 to it.
11.4.6.
Conversion result threshold monitor function
The analog watchdog is enabled when the RWDEN bit in the ADC_CTL0 register is set for
routine sequence. This function is used to monitor whether the conversion result exceeds the
set thresholds, and
the WDE bit in ADC_STAT register will be set. An interrupt will be
generated if the WDEIE bit is set. The ADC_WDHT and ADC_WDLT registers are used to
specify the high and low threshold. The comparison is done before the alignment, so the
threshold values are independent of the alignment, which is specified by the DAL bit in the
ADC_CTL1 register. One or more channels, which are select by the RWDEN, WDSC and
WDCHSEL[4:0] bits in ADC_CTL0 register, can be monitored by the analog watchdog.
11.4.7.
Data storage mode
The alignment of data stored after conversion can be specified by DAL bit in the ADC_CTL1
register.
Summary of Contents for GD32F10 Series
Page 63: ...GD32F10x User Manual 63 programmed during the chip production ...
Page 117: ...GD32F10x User Manual 117 010 1 0 011 0 9 ...
Page 416: ...GD32F10x User Manual 416 shadow register updates every update event ...
Page 427: ...GD32F10x User Manual 427 value ...
Page 518: ...GD32F10x User Manual 518 These bits are not used in SPI mode ...