18.2.5 Operation with ADC
The Analog Peripheral Manager can be used to periodically activate the ADC module to control the timing in which conversions are performed. The ADC is unique in comparison to the other analog modules that can be controlled by the APM, as it has separate Peripheral Start and Stop Enable bits to enable the ADC and trigger a conversion.
Additionally, it is important to ensure enough time has lapsed after an ADCA Start Event to allow the ADC to stabilize so that it is ready to perform a conversion before an ADCD Start Event occurs. Setting the ADCD bit will not only allow the APM to trigger an ADC conversion, but also enables threshold comparison and other computation features of the ADC.
When using the APM module, the ADC module must be enabled before a triggering a conversion; generally the ADCA Start Event must occur before the ADCD Start Event to ensure that the controller has been enabled and initialized before a conversion is triggered. The ADCA and ADCD End Events can both occur at the same time once the ADC conversion has been completed. It is important to ensure enough time has lapsed after a conversion has been triggered (ADCD Start Event) to account for the complete ADC conversion time before the ADC is disabled again by the APM. If the ADCA or ADCD bits of either the APMPERE1 or APMPERE2 registers are cleared before the ADC conversion has been completed, the results may be incorrect.