32.2.2 Completion of a Conversion
When any individual conversion is complete, the value already in
ADRES is written into ADPREV (if PSIS =
1
) and the new conversion result appears in ADRES. When the conversion
completes, the ADC module will:
- Clear the GO bit (unless the CONT bit is set)
- Set the ADIF Interrupt Flag bit
- Set the MATH bit in the ADSTAT register
- Update ADACC
When DSEN =
0
then after every conversion, or when DSEN =
1
then after every other conversion, the following events occur:
- ADERR is calculated
- ADTIF interrupt is set if ADERR calculation meets threshold comparison
Importantly, filter and threshold computations occur after the conversion itself is complete. As such, interrupt handlers responding to ADIF must check ADTIF before reading filter and threshold results.