I am using PortA.0, PortA.1 and PortA.2 to read the individual values for my line following sensor. The sensor is a TCRT5000 device x 3.

Here is my code, any ideas please ?

@ DEVICE XT_OSC,MCLR_OFF,LVP_OFF,WDT_OFF,PROTECT_OFF

DEFINE LOADER_USED 1
Include "Modedefs.Bas"

Define OSC 4 ' We're using a 4MHz Resonator


define DEBUG_REG PORTB ' DEBUG PORT
DEFINE DEBUG_BIT 6
DEFINE DEBUG_BAUD 9600
DEFINE DEBUG_PACING 500

CLR CON 1 ' CLR LCD command
LINE1 CON 128 ' LCD line #1
LINE2 CON 192 ' LCD line #2
LINE3 CON 148 ' LCD line #3
LINE4 CON 212 ' LCD line #4
INS CON 254 ' LCD command mode parameter


DEFINE ADC_BITS 8 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (rc = 3)
DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds

TRISA = %11111111 'RA.0:3 Input
TRISB = %00000000 'all PORTB output

'ANSEL = %00000001 'only porta.0 is analogue
ADCON1 = %00000010 'right justify the result(top bits are read as zero)
CMCON = 7 'Turn off comparators

piezo var portb.7
LOW PIEZO

msensor var word
lsensor var word
rsensor var word

' motor driver logic to 0 - low all port pins
low portb.0
low portb.1
low portb.3
low portb.4
pause 500

init:

DEBUG INS,CLR
pause 30

DEBUG INS,LINE1,"L= R= " : PAUSE 30
DEBUG INS,LINE2,"M= " : pause 30

checkit:

ANSEL = %00000001 ' Only porta.0 is analogue
ADCON0 = %01000101 ' Control register 000 RA0/AN0

adcin porta.0,lsensor
DEBUG INS,LINE1+3, dec lsensor," " : pause 30

'--------------------------------------------------------------------

ANSEL = %00000010 'only porta.1 is analogue
ADCON0 = %01001101 ' Control register 000 RA1/AN1

adcin porta.1,msensor
DEBUG INS,LINE2+3, dec msensor," " : PAUSE 30

'--------------------------------------------------------------------

ANSEL = %00000100 'only porta.2 is analogue
ADCON0 = %01010101 ' Control register 000 RA1/AN1

adcin porta.2,rsensor
DEBUG INS,LINE1+11, dec rsensor," " : pause 30

goto checkit