English
Language : 

PIC16LF18854 Datasheet, PDF (342/668 Pages) Microchip Technology – C Compiler Optimized RISC Architecture
PIC16(L)F18856/76
23.2 ADC Operation
23.2.1 STARTING A CONVERSION
To enable the ADC module, the ADON bit of the
ADCON0 register must be set to a ‘1’. A conversion
may be started by any of the following:
• Software setting the ADGO bit of ADCON0 to ‘1’
• An external trigger (selected by Register 23-3)
• A continuous-mode retrigger (see section
Section 23.5.8 “Continuous Sampling Mode”)
.
Note:
The ADGO bit should not be set in the
same instruction that turns on the ADC.
Refer to Section 23.2.7 “ADC Conver-
sion Procedure (Basic Mode)”.
23.2.2 COMPLETION OF A CONVERSION
When any individual conversion is complete, the value
already in ADRES is written into ADPREV (if
ADPSIS=1) and the new conversion results appear in
ADRES. When the conversion completes, the ADC
module will:
• Clear the ADGO bit (Unless the ADCONT bit of
ADCON0 is set)
• Set the ADIF Interrupt Flag bit
• Set the ADMATH bit
• Update ADACC
When ADDSEN=0 then after every conversion, or
when ADDSEN=1 then after every other conversion,
the following events occur:
• ADERR is calculated
• ADTIF is set if ADERR calculation meets thresh-
old requirements
In addition, on the completion of every conversion if
ADDSEN=0, or every other conversion if ADDSEN=1:
• ADSTPE is calculated
• Depending on ADSTPE, the threshold compari-
son may set ADTIF
Importantly, filter and threshold computations occur
after the conversion itself is complete. As such,
interrupt handlers responding to ADIF should check
ADTIF before reading filter and threshold results.
23.2.3 TERMINATING A CONVERSION
If a conversion must be terminated before completion,
the ADGO bit can be cleared in software. The ADRESH
and ADRESL registers will be updated with the partially
complete Analog-to-Digital conversion sample.
Incomplete bits will match the last bit converted. In this
case, filter and/or threshold occur.
Note:
A device Reset forces all registers to their
Reset state. Thus, the ADC module is
turned off and any pending conversion is
terminated.
DS40001824A-page 342
Preliminary
 2016 Microchip Technology Inc.