10.2 ADC configuration
When configuring and using ADC, the following factors must be considered:
◆ Port configuration;
◆ Reference voltage selection;
◆ Channel selection;
◆ ADC conversion clock source;
◆ Interrupt control;
◆ The storage format of the result.
10.2.1 Port configuration
ADC can convert both analog signal and digital signal. When converting analog signal, the I/O pin should
be configured as analog input pin by setting the corresponding TRIS bit to 1. For more information, please
refer to the corresponding port chapter.
10.2.2 Channel selection
The CHS bit of the ADCON0 register determines which channel is connected to the sample and hold
circuit.
If the channel is changed, a certain delay will be required before the next conversion starts. For more
information, please refer to the "ADC working principle" chapter.
10.2.3 ADC internal base voltage
Built-in base voltage, the CHS [4:0] should be configured as 10011 when this voltage needs to be
detected.
10.2.4 ADC reference voltage
The ADC reference voltage can be provided by internal LDO or the chip's VDD and GND. 1.2V/2.0V/2.4V
can be selected as the reference voltage. Needing to select a lower convert clock if internal reference voltage
is selected, see the “Converter clock”.
Note: The effective accuracy of the ADC will decrease if reference voltage is provided by internal LDO.
The lower detected voltage, the higher accuracy of the ADC will be obtained. It is recommended
that the input voltage set to lower than 1V.