English
Language : 

PIC24FV32KA304 Datasheet, PDF (213/322 Pages) Microchip Technology – 20/28/44/48-Pin, General Purpose, 16-Bit Flash Microcontrollers with XLP Technology
PIC24FV32KA304 FAMILY
To perform an A/D conversion:
1. Configure the A/D module:
a) Configure 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
expected range on 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:5>
and
AD1CON3<12:8>).
e) Select how conversion results are
presented in the buffer (AD1CON1<9:8>).
f) Select interrupt rate (AD1CON2<5:2>).
g) Turn on A/D module (AD1CON1<15>).
2. Configure A/D interrupt (if required):
a) Clear the AD1IF bit.
b) Select A/D interrupt priority.
To perform an A/D sample and conversion using
Threshold Detect scanning:
1. Configure the A/D module:
a) Configure port pins as analog inputs
(ANS<12:10>, ANS<5,0>).
b) Select voltage reference source to match
expected range on 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:5>, AD1CON3<12:8>).
e) Select how the conversion results are
presented in the buffer (AD1CON1<9:8>).
f) Select interrupt rate (AD1CON2<5:2>).
2. Configure the Threshold compare channels:
a) Enable auto-scan (ASEN bit (AD1CON<15>)).
b) Select the Compare mode “Greater Than,
Less Than or Windowed” (CM bits
(AD1CON5<1:0>)).
c) Select the threshold compare channels to
be scanned (ADCSSH, ADCSSL).
d) If the CTMU is required as a current source
for a threshold compare channel, enable
the corresponding CTMU channel
(ADCCTMUENH, ADCCTMUENL).
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 A/D interrupt (OPTIONAL):
a) Clear the AD1IF bit.
b) Select A/D interrupt priority.
 2011 Microchip Technology Inc.
DS39995A-page 213