English
Language : 

PIC16F87-E Datasheet, PDF (115/228 Pages) Microchip Technology – 18/20/28-Pin Enhan lashMicrocontrollers with nanoWatt Technology
PIC16F87/88
12.0 ANALOG-TO-DIGITAL
CONVERTER (A/D) MODULE
The Analog-to-Digital (A/D) converter module has
seven inputs for 18/20 pin devices (PIC16F88 devices
only).
The conversion of an analog input signal results in a
corresponding 10-bit digital number. The A/D module
has a high and low-voltage reference input that is
software selectable to some combination of VDD, VSS,
VREF- (RA2) or VREF+ (RA3).
The A/D converter has a unique feature of being able
to operate while the device is in Sleep mode. To oper-
ate in Sleep, the A/D conversion clock must be derived
from the A/D’s internal RC oscillator.
The A/D module has five registers:
• A/D Result High Register (ADRESH)
• A/D Result Low Register (ADRESL)
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
• Analog Select Register (ANSEL)
The ADCON0 register, shown in Register 12-2,
controls the operation of the A/D module. The ANSEL
register, shown in Register 12-1 and the ADCON1
register, shown in Register 12-3, configure the func-
tions of the port pins. The port pins can be configured
as analog inputs (RA3/RA2 can also be voltage
references) or as digital I/O.
Additional information on using the A/D module can be
found in the “PICmicro® Mid-Range MCU Family
Reference Manual” (DS33023).
REGISTER 12-1:
ANSEL:ANALOG SELECTREGISTER(ADDRESS9Bh)PIC16F88DEVICESONLY
U-0
R/W-1
R/W-1
R/W-1
R/W-1 R/W-1 R/W-1 R/W-1
—
ANS6
ANS5
ANS4
ANS3 ANS2 ANS1 ANS0
bit 7
bit 0
bit 7
bit 6-0
Unimplemented: Read as ‘0’
ANS<6:0>: Analog Input Select bits
Bits select input function on corresponding AN<6:0> pins.
1 = Analog I/O(1,2)
0 = Digital I/O
Note 1: Setting a pin to an analog input disables the digital input buffer. The corresponding
TRIS bit should be set to input mode when using pins as analog inputs. Only AN2 is
an analog I/O, all other ANx pins are analog inputs.
2: See the block diagrams for the analog I/O pins to see how ANSEL interacts with the
CHS bits of the ADCON0 register.
Legend:
R = Readable bit
-n = Value at POR
W = Writable bit
‘1’ = Bit is set
U = Unimplemented bit, read as ‘0’
‘0’ = Bit is cleared x = Bit is unknown
 2005 Microchip Technology Inc.
DS30487C-page 113