Datasheet
© 2009 Microchip Technology Inc. DS39775C-page 301
PIC18F87J50 FAMILY
21.0 10-BIT ANALOG-TO-DIGITAL
CONVERTER (A/D) MODULE
The Analog-to-Digital (A/D) Converter module has
8 inputs for the 64-pin devices and 12 for the 80-pin
devices. This module allows conversion of an analog
input signal to a corresponding 10-bit digital number.
The module has six registers:
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
• A/D Port Configuration Register 2 (ANCON0)
• A/D Port Configuration Register 1 (ANCON1)
• A/D Result Registers (ADRESH and ADRESL)
The ADCON0 register, shown in Register 21-1, controls
the operation of the A/D module. The ADCON1 register,
shown in Register 21-2, configures the A/D clock source,
programmed acquisition time and justification.
The ANCON0 and ANCON1 registers, shown in
Register 21-4 and Register 21-3, configure the
functions of the port pins.
REGISTER 21-1: ADCON0: A/D CONTROL REGISTER 0
(1)
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
VCFG1 VCFG0 CHS3 CHS2 CHS1 CHS0 GO/DONE
ADON
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-6 VCFG1: Voltage Reference Configuration bit (V
REF- source)
1 = V
REF- (AN2)
0 = AV
SS
bit
VCFG0: Voltage Reference Configuration bit (VREF+ source)
1 = V
REF+ (AN3)
0 = AV
DD
bit 5-2 CHS3:CHS0: Analog Channel Select bits
0000 = Channel 00 (AN0)
0001 = Channel 01 (AN1)
0010 = Channel 02 (AN2)
0011 = Channel 03 (AN3)
0100 = Channel 04 (AN4)
0101 = Unused
0110 = Unused
0111 = Channel 07 (AN7)
1000 = Unused
1001 = Unused
1010 = Channel 10 (AN10)
1011 = Channel 11 (AN11)
1100 = Channel 12 (AN12)
(2,3)
1101 = Channel 13 (AN13)
(2,3)
1110 = Channel 14 (AN14)
(2,3)
1111 =Channel 15 (AN15)
(2,3)
bit 1 GO/DONE: A/D Conversion Status bit
When ADON =
1:
1 = A/D conversion in progress
0 = A/D Idle
bit 0 ADON: A/D On bit
1 = A/D Converter module is enabled
0 = A/D Converter module is disabled
Note 1: Default (legacy) SFR at this address, available when WDTCON<4> = 0.
2: These channels are not implemented on 64-pin devices.
3: Performing a conversion on unimplemented channels will return random values.