Rev. 1.10
94
November 04, 2019
Rev. 1.10
95
November 04, 2019
HT45F5Q-3
Battery Charger Flash MCU
HT45F5Q-3
Battery Charger Flash MCU
•
Step 4
If the A/D converter input signal comes from the external channel input selecting by configuring
the SAINS bit field, the corresponding pins should be configured as A/D converter input function
by configuring the relevant pin-shared function control bits. The desired analog channel then
should be selected by configuring the SACS bit field. After this step, go to Step 6.
• Step 5
Before the A/D converter input signal is selected to come from the internal analog signal by
configuring the SAINS bit field, the corresponding external input pin must be switched to a
non-existed channel input by setting the SACS3~SACS0 bits with a value from 1010 to 1111.
The desired internal analog signal then can be selected by configuring the SAINS bit field. After
this step, go to Step 6.
• Step 6
Select the reference voltage source by configuring the SAVRS1~SAVRS0 bits in the SADC1
register.
•
Step 7
Select A/D converter output data format by setting the ADRFS bit in the SADC0 register.
• Step 8
If A/D conversion interrupt is used, the interrupt control registers must be correctly configured
to ensure the A/D interrupt function is active. The master interrupt control bit, EMI, and the A/D
conversion interrupt control bit, ADE, must both be set high in advance.
• Step 9
The A/D conversion procedure can now be initialized by setting the START bit from low to high
and then low again.
•
Step 10
If A/D conversion is in progress, the ADBZ flag will be set high. After the A/D conversion process
is complete, the ADBZ flag will go low and then the output data can be read from SADOH and
SADOL registers.
Note: When checking for the end of the conversion process, if the method of polling the ADBZ bit
in the SADC0 register is used, the interrupt enable step above can be omitted.
Programming Considerations
During microcontroller operations where the A/D converter is not being used, the A/D internal
circuitry can be switched off to reduce power consumption, by clearing bit ADCEN to 0 in the
SADC0 register. When this happens, the internal A/D converter circuits will not consume power
irrespective of what analog voltage is applied to their input lines. If the A/D converter input lines are
used as normal I/O pins, then care must be taken as if the input voltage is not at a valid logic level,
then this may lead to some increase in power consumption.
A/D Conversion Function
As the device contains a 12-bit A/D converter, its full-scale converted digitised value is equal to
FFFH. Since the full-scale analog input value is equal to the actual A/D converter reference voltage,
V
REF,
this gives a single bit analog input value of V
REF
divided by 4096.
1 LSB = V
REF
/4096
The A/D Converter input voltage value can be calculated using the following equation:
A/D input voltage = A/D output digital value
× (V
REF
/4096)