Datasheet
PIC18F87K90 FAMILY
DS39957D-page 380 2009-2011 Microchip Technology Inc.
The ANCONx registers are used to configure the
operation of the I/O pin associated with each analog
channel. Clearing a ANSELx bit configures the
corresponding pin (ANx) to operate as a digital only I/O.
Setting a bit configures the pin to operate as an analog
input for either the A/D Converter or the comparator
module, with all digital peripherals disabled and digital
inputs read as ‘
0’.
As a rule, I/O pins that are multiplexed with analog
inputs default to analog operation on any device Reset.
REGISTER 23-8: ANCON0: A/D PORT CONFIGURATION REGISTER 0
R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1
ANSEL7 ANSEL6 ANSEL5 ANSEL4 ANSEL3 ANSEL2 ANSEL1 ANSEL0
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-0
ANSEL<7:0>: Analog Port Configuration bits (AN7 and AN0)
0 = Pin is configured as a digital port
1 = Pin is configured as an analog channel – digital input disabled and any inputs read as ‘0’
REGISTER 23-9: ANCON1: A/D PORT CONFIGURATION REGISTER 1
R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1
ANSEL15
(1)
ANSEL14
(1)
ANSEL13
(1)
ANSEL12
(1)
ANSEL11 ANSEL10 ANSEL9 ANSEL8
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-0
ANSEL<15:8>: Analog Port Configuration bits (AN15 through AN8)
0 = Pin is configured as a digital port
1 = Pin is configured as an analog channel – digital input is disabled and any inputs read as ‘0’
Note 1: AN12 through AN15, and AN20 to AN23, are implemented only on 80-pin devices. For 64-pin devices, the
corresponding ANSELx bits are still implemented for these channels, but have no effect.