BAT32G1x9 user manual | Chapter 15 A/D converter
523 / 1149
Rev.1.02
15.5.4 Select the setting for the output voltage/internal reference voltage of the temperature sensor
(Take software trigger mode, single conversion mode as an example)
Figure15-35 Settings when selecting the output voltage/internal reference voltage of the temperature sensor
configuration starts
configuration PER0
register
configuration PMC register
configuration ADM0 register
configuration ADM1 register
configuration ADM2 register
configuration ADTRG register
configuration ADNSMP register
configuration ADUL/ADLL register
configuration ADS register
(configure sequence not in specific
order
)
configuration ADCE bit
power source stablization
wait cycles counting
configuration ADCS bit
start A/D conversion
set ADCEN bit of PER0 register to 1, start provide clock
configure P20/AVREFP, P21/AVREFM ports as analog
input: configure via PMC2 register.
ADM0 register
FR2~FR0 bit: configure A/D conversion time.
ADM1 register
ADMD bit: configure as selection mode
ADSCM bit: configure as single conversion mode
ADTRG register
ADTMD1 bit, ADTMD0 bit: configure as software trigger mode
ADM2 register
ADREFP bit, ADREFM bit: Select P20/AVREFP, P21/AVREFM as reference
voltage.
ADS register
select temperature sensor output voltage or internal reference voltage
set ADCS bit of ADM0 register to 1, enter into hardware
trigger standby state.
set ADCS bit of ADM0 register to 1m start A/D conversion.
Generate A/D covnersion completion interrupt (INTAD).
A/D conversion in
progress
A/D conversion completes
save conversion result into
ADCR register.
save conversion result into ADCR register.
Do not use the 1st A/D conversion result after ADISS bit set to 1.
to avoid temperature sensor or internal reference voltage
corrupted by high voltage residue from A/D sample circuit,
the hardware automatically perform one discharge
conversion, which is use P21/AVREFM as input of A/D to
perform one time conversion.
configuration ADCS bit
start A/D conversion
A/D conversion completes
save conversion result into
ADCR register.
counting power source stablization wait cycles (1us) via
software
set ADCS bit of ADM0 register to 1, start conversion.
A/D conversion in
progress
Generate A/D covnersion completion interrupt (INTAD).
save conversion result into ADCR register.