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.
0
’ by user software.