Hi,

i will continue here and not start a new thread.
I am attempting to have two input values for an A/D conversion.
I added these two lines and did some changes.
How do I use the other input analog ports?

ken


' PicBasic Pro program to display result of
' 10-bit A/D conversion on LCD
'
' Connect analog input to channel-0 and channel1 (RA0, RA1)

' Define LCD registers and bits
Define LOADER_USED 1

DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 0 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD

' Define ADCIN parameters
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS


right var word 'Create right to store result
left var word

TRISA = %11111111 ' Set PORTA to all input
TRISB = 0
ADCON1 = %11000001 ' Set PORTA analog and RIGHT justify result
ADCON0 = %00000001 ' Configure and turn on A/D Module
Pause 500 ' Wait .5 second


loop: ADCON0.2 = 1 'Start Conversion

notdone: pause 5
if ADCON0.2 = 1 Then notdone 'wait for low on bit-2 of ADCON0, conversion finished

ADCIN 0, right 'Read channel 0
ADCIN 1, left 'Read channel 1

right.highbyte = ADRESH 'move HIGH byte of result to right
right.lowbyte = ADRESL 'move LOW byte of result to right

left.highbyte = ADRESH 'move HIGH byte of result to left
left.lowbyte = ADRESL 'move LOW byte of result to left

Lcdout $fe, 1 'Clear screen
Lcdout "Value right: ", DEC right 'Display the decimal value
Lcdout $C0, "Value left: ", DEC left 'Display the decimal value

Pause 100 'Wait .1 second

Goto loop 'Do it forever
End