Microchip Technology ARD00385 Data Sheet

Page of 570
 2009-2011 Microchip Technology Inc.
DS39957D-page 373
PIC18F87K90 FAMILY
23.0
12-BIT ANALOG-TO-DIGITAL 
CONVERTER (A/D) MODULE
The Analog-to-Digital (A/D) Converter module in the
PIC18F87K90 family of devices has 16 inputs for the
64-pin devices and 24 inputs for the 80-pin devices.
This module allows conversion of an analog input
signal to a corresponding signed 12-bit digital number. 
The module has these registers:
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
• A/D Control Register 2 (ADCON2)
• A/D Port Configuration Register 0 (ANCON0)
• A/D Port Configuration Register 1 (ANCON1)
• A/D Port Configuration Register 2 (ANCON2)
• ADRESH (the upper A/D Results register)
• ADRESL (the lower A/D Results register)
The ADCON0 register, shown in 
, con-
trols the operation of the A/D module. The ADCON1
register, shown in 
, configures the voltage
reference and special trigger selection. The ADCON2
register, shown in 
, configures the A/D
clock source and programmed acquisition time and
justification.
23.1
Differential A/D Converter
The converter in PIC18F87K90 family devices is
implemented as a differential A/D where the differential
voltage between two channels is measured and
converted to digital values (see 
).
The converter can also be configured to measure a
voltage from a single input by clearing the CHSN bits
(ADCON1<2:0>). With this configuration, the negative
channel input is connected internally to AV
SS
 (see
FIGURE 23-1:
DIFFERENTIAL CHANNEL 
MEASUREMENT
Differential conversion feeds the two input channels to
a unity gain differential amplifier. The positive channel
input is selected using the CHS bits (ADCON0<6:2>)
and the negative channel input is selected using the
CHSN bits (ADCON1<2:0>).
The output from the amplifier is fed to the A/D convert,
as shown in 
. The 12-bit result is available
on the ADRESH and ADRESL registers. There is also
a sign bit, along with the 12-bit result, indicating if the
result is a positive or negative value.
FIGURE 23-2:
SINGLE CHANNEL 
MEASUREMENT
In the Single Channel Measurement mode, the
negative input is connected to A
VSS
 by clearing the
CHSN bits (ADCON1<2:0>).
ADC
Positive input
CHS<4:0>
Negative input
CHSN<2:0>
+
ADC
Positive input
CHS<4:0>
CHSN<2:0>
= 000
+
AV
SS