English
Language : 

PIC18F-LF1XK50 Datasheet, PDF (98/420 Pages) Microchip Technology – 20-Pin USB Flash Microcontrollers
PIC18F/LF1XK50
9.4 Port Analog Control
Some port pins are multiplexed with analog functions
such as the Analog-to-Digital Converter and compara-
tors. When these I/O pins are to be used as analog
inputs it is necessary to disable the digital input buffer
to avoid excessive current caused by improper biasing
of the digital input. Individual control of the digital input
buffers on pins which share analog functions is pro-
vided by the ANSEL and ANSELH registers. Setting an
ANSx bit high will disable the associated digital input
buffer and cause all reads of that pin to return ‘0’ while
allowing analog functions of that pin to operate
correctly.
The state of the ANSx bits has no affect on digital
output functions. A pin with the associated TRISx bit
clear and ANSx bit set will still operate as a digital
output but the Input mode will be analog.
REGISTER 9-15: ANSEL: ANALOG SELECT REGISTER 1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
U-0
U-0
U-0
ANS7
ANS6
ANS5
ANS4
ANS3
—
—
—
bit 7
bit 0
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
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
ANS7: RC3 Analog Select Control bit
1 = Digital input buffer of RC3 is disabled
0 = Digital input buffer of RC3 is enabled
ANS6: RC2 Analog Select Control bit
1 = Digital input buffer of RC2 is disabled
0 = Digital input buffer of RC2 is enabled
ANS5: RC1 Analog Select Control bit
1 = Digital input buffer of RC1 is disabled
0 = Digital input buffer of RC1 is enabled
ANS4: RC0 Analog Select Control bit
1 = Digital input buffer of RC0 is disabled
0 = Digital input buffer of RC0 is enabled
ANS3: RA4 Analog Select Control bit
1 = Digital input buffer of RA4 is disabled
0 = Digital input buffer of RA4 is enabled
Unimplemented: Read as ‘0’
DS41350E-page 98
Preliminary
 2010 Microchip Technology Inc.