BAT32G1x9 user manual | Chapter 15 A/D converter
520 / 1149
Rev.1.02
15.5
Setup flowchart for the converter
The setup flowchart of the A/D
converters for each operating mode
is shown below.
15.5.1 The setting of the software trigger mode
Figure15-32 software trigger mode
configuration starts
configure PER0 register
configure PMC register
configure ADM0 register
configure ADM1 register
configure ADM2 register
configure ADTRG register
configure ADNSMP register
configure ADUL/ADLL register
configure ADS register
(configure sequence not in specific
order)
configure ADCE bit
power source stablization
wait cycles counting
configure ADCS bit
start A/D conversion
set ADCEN bit of PER0 register to 1, start provide clock
configure port as analog input: configure via PMCx register
ADM0 register
FR2~FR0 bit: configure A/D conversion time.
ADM1 register
ADSCM bit: continous conversion / single conversion
ADMD bit: selection mode/Scan mode
ADTRG register
ADTMD1 bit, ADTMD0 bit: configure as software trigger mode
ADM2 register
ADREFP bit, ADREFM bit: Select reference voltage
ADRCK bit: select compare range of A/D conversion result which
generates interrupt signal
ADNSMP register
configure sampling time
ADUL/ADLL register
configure A/D conversion result comparision upper and lower limit
ADS register
select analog input channel
set ADCE bit of ADM0 register to 1, enter A/D conversion standby state.
counting power source stablization wait cycles (1us) via software
set ADCS bit of ADM0 register to 1m start A/D conversion.
based on ADRCK bit and ADUL/ADLL register configuration,
compare with result of A/D conversion, hardware will
automatically decide whether to generate A/D conversion
completion interrupt (INTAD).
A/D conversion in
progress
A/D conversion completes
save conversion result into
ADCR register.
if A/D conversion interrupt (INTAD) is generated, the
conversion result will be saved into ADCR register. Otherwise,
the conversion result will not be saved into ADCR register.