Datasheet
© 2009 Microchip Technology Inc. DS39775C-page 303
PIC18F87J50 FAMILY
The ANCON0 and ANCON1 registers are used to
configure the operation of the I/O pin associated with
each analog channel. Setting any one of the PCFG bits
configures the corresponding pin to operate as a digital
only I/O. Clearing a bit configures the pin to operate as
an analog input for either the A/D Converter or the com-
parator module; all digital peripherals are disabled, and
digital inputs read as ‘0’. As a rule, I/O pins that are
multiplexed with analog inputs default to analog
operation on device Resets.
ANCON0 and ANCON1 are shared address SFRs, and
use the same addresses as the ADCON1 and
ADCON0 registers. The ANCON registers are
accessed by setting the ADSHR bit (WDTCON<4>).
See Section 5.3.5.1 “Shared Address SFRs” for
more information.
REGISTER 21-3: ANCON0: A/D PORT CONFIGURATION REGISTER 2
R/W-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PCFG7
— — PCFG4 PCFG3 PCFG2 PCFG1 PCFG0
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 PCFG7: Analog Port Configuration bits (AN7)
1 = Pin configured as a digital port
0 = Pin configured as an analog channel - digital input disabled and reads ‘0’
bit 6-5 Unimplemented: Read as ‘0’
bit 4-0 PCFG4:PCFG0: Analog Port Configuration bits (AN4-AN0)
1 = Pin configured as a digital port
0 = Pin configured as an analog channel - digital input disabled and reads ‘0’
REGISTER 21-4: ANCON1: A/D PORT CONFIGURATION REGISTER 1
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 U-0
PCFG15 PCFG14 PCFG13 PCFG12 PCFG11 PCFG10
— —
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-2 PCFG15:PCFG10: Analog Port Configuration bits (AN15-AN10)
(1)
1 = Pin configured as a digital port
0 = Pin configured as an analog channel - digital input disabled and reads ‘0’
bit 1-0 Unimplemented: Read as ‘0’
Note 1: AN15 through AN12 are available only in 80-pin devices.