Hi all,
i have the following problem:
I use Aanalog 2 (RA2) and Analog 3 (RA4) to measure DC Voltage on a PIC18LF14K22.

The uP is configured to run with internal oscillator:
OSCCON = %01110010 ' configure internal OSC @ 16MHZ
OSCTUNE = %00000000
While OSCCON.2=0 : wend ' wait until OSC is stable

After that i configure Port A to use RA0 to RA3 as ADC:

TRISA = %111111
ADCON1 = %00000000
ADCON2 = %10000111 ' Right justified, Frc
ANSEL = %00001111
ANSELH = %00000000

Then in two subroutines i read back Aanalog 2 and Analog 3:

1:
ADCON0 = %00001011 ' Start the conversion of ad channel 2
WHILE ADCON0.1 = 1 ' Wait for it to complete
i = 0
WEND
adc2_value = (adc2_value + ((ADRESH * 256) + ADRESL)) / 2 ' get result from AN2 with avg by two

2.
ADCON0 = %00001111 ' Start the conversion of ad channel 3
WHILE ADCON0.1 = 1 ' Wait for it to complete
i = 0
WEND
adc3_value = (adc3_value + ((ADRESH * 256) + ADRESL)) / 2 ' get result from AN3 with avg by two

The result vars are defined as word.

Now the problem:
1. Always delivers correct values

2. Brings always the same value (50), but it should vary between 50 and 200...

Don't know the reason why Analog 3 is always same value, can somebody help!?
Regards,
Ralf