English
Language : 

PIC24FV16KM204 Datasheet, PDF (211/336 Pages) Microchip Technology – General Purpose, 16-Bit Flash Microcontroller with XLP Technology Data Sheet
PIC24FV16KM204 FAMILY
To perform an A/D conversion:
1. Configure the A/D module:
a) Configure the port pins as analog inputs
and/or select band gap reference inputs
(ANS<12:10>, ANS<5:0>).
b) Select voltage reference source to match
the expected range on the analog inputs
(AD1CON2<15:13>).
c) Select the analog conversion clock to
match the desired data rate with the
processor clock (AD1CON3<7:0>).
d) Select the appropriate sample/conversion
sequence (AD1CON1<7:4> and
AD1CON3<12:8>).
e) Configure the MODE12 bit to select A/D
resolution (AD1CON1<10>).
f) Select how conversion results are
presented in the buffer (AD1CON1<9:8>).
g) Select the interrupt rate (AD1CON2<6:2>).
h) Turn on the A/D module (AD1CON1<15>).
2. Configure the A/D interrupt (if required):
a) Clear the AD1IF bit.
b) Select the A/D interrupt priority.
To perform an A/D sample and conversion using
Threshold Detect scanning:
1. Configure the A/D module:
a) Configure the port pins as analog inputs
(ANS<12:10>, ANS<5,0>).
b) Select the voltage reference source to
match the expected range on the analog
inputs (AD1CON2<15:13>).
c) Select the analog conversion clock to
match the desired data rate with the
processor clock (AD1CON3<7:0>).
d) Select the appropriate sample/conversion
sequence (AD1CON1<7:4> and
AD1CON3<12:8>).
e) Configure the MODE12 bit to select A/D
resolution (AD1CON1<10>).
f) Select how the conversion results are
presented in the buffer (AD1CON1<9:8>).
g) Select the interrupt rate (AD1CON2<6:2>).
2. Configure the threshold compare channels:
a) Enable auto-scan; set the ASEN bit
(AD1CON5<15>).
b) Select the Compare mode “Greater Than,
Less Than or Windowed”; set the CMx bits
(AD1CON5<1:0>).
c) Select the threshold compare channels to
be scanned (AD1CSSH, AD1CSSL).
d) If the CTMU is required as a current
source for a threshold compare channel,
enable the corresponding CTMU channel
(AD1CTMENH, AD1CTMENL).
e) Write the threshold values into the
corresponding ADC1BUFn registers.
f) Turn on the A/D module (AD1CON1<15>).
Note:
If performing an A/D sample and
conversion using Threshold Detect in
Sleep Mode, the RC A/D clock source
must be selected before entering into
Sleep mode.
3. Configure the A/D interrupt (OPTIONAL):
a) Clear the AD1IF bit.
b) Select the A/D interrupt priority.
 2013 Microchip Technology Inc.
Advance Information
DS33030A-page 211