16.2.3 Analog Control
The ANSELx register is used to configure the Input mode of an I/O
pin to analog. Setting the appropriate ANSELx bit high will cause all digital reads on the
pin to be read as ‘0
’ and allow analog functions on
the pin to operate correctly.
The state of the ANSELx bits has no effect on digital output
functions. A pin with TRIS clear and ANSEL set will still operate as a digital output, but
the Input mode will be analog. This can cause unexpected behavior when executing
READ-MODIFY-WRITE
instructions on the affected port.
Important: The ANSELx bits default to the Analog mode after
Reset. To use any pins as digital general purpose or peripheral inputs, the corresponding
ANSEL bits must be initialized to ‘
0
’ by user software.