Hi Barry,
In your latest attached code you have the line
Code:
ANSEL = %01011010       ' Set Fosc/16
Which sets GPIO.4/AN3 to analog mode. Try changing it to digital if you haven't already done that.