Rev. 1.00
126
September 11, 2018
Rev. 1.00
127
September 11, 2018
HT45F4050
A/D NFC Flash MCU
HT45F4050
A/D NFC Flash MCU
Summary of A/D Conversion Steps
The following summarises the individual steps that should be executed in order to implement an A/D
conversion process.
• Step 1
Select the required A/D conversion clock by properly programming the SACKS2~SACKS0 bits
in the SADC1 register.
• Step 2
Enable the A/D converter by setting the ADCEN bit in the SADC0 register to "1".
• Step 3
Select which signal is to be connected to the internal A/D converter by correctly configuring the
SAINS and SACS bit fields.
Select the external channel input to be converted, go to Step 4.
Select the internal analog signal to be converted, go to Step 5.
• Step 4
If the SAINS field is 0000, 0100 or 11xx, the external channel input can be selected. The desired
external channel input is selected by configuring the SACS field. When the A/D input signal
comes from the external channel input, the corresponding pin should be configured as an A/D
input function by configuring the relevant pin-shared function control bits. Then go to Step 6.
• Step 5
If the SAINS field is set to 0x01, 0x10 or 0x11, the relevant internal analog signal will be
selected. When the internal analog signal is selected to be converted, the external channel analog
input will automatically be disconnected. Then go to Step 6.
• Step 6
Select the reference voltage source by configuring the SAVRS1~SAVRS0 bits in the SADC2
register. Enable the PGA, select the PGA input signal and the desired PGA gain if the PGA output
voltage or its division is selected as the A/D converter reference voltage.
• Step 7
Select A/D converter output data format by configuring the ADRFS bit in the SADC0 register
.
• Step 8
If A/D converter interrupt is used, the interrupt control registers must be correctly configured to
ensure the A/D converter interrupt function is active. The master interrupt control bit, EMI, and
the A/D converter interrupt bits, ADE, must both set high in advance.
• Step 9
The A/D conversion procedure can now be initialised 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 completed, the ADBZ flag will go low and then output data can be read from the
SADOH and SADOL registers. If the ADC interrupt is enabled and the stack is not full, data can
be acquired by interrupt service program.
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.