Hi
I'm facing very weird problem with PIC18F4550 internal 10 bits A/D, I did set the Vref and -Vref to VDD and VSS, chose channel 0, but the maximum voltage the A/D can read was 2.5 volts (code: 511), which mean half the scale expected, can anyone give me a logical reason why this happen, this is the code I used:
unsigned char low,high;
//set port A as input
TRISA = 0xFF;
//ADCON0 -> select channel AN0 and enable A/D
ADCON0 = 0b00000001;
//ADCON1 -> set Vref+ and Vref- to VDD and VSS and set AN0 only to analog input
ADCON1 = 0b00001110;
//ADCON2 -> result right justified, Acquisition time = 6TAD, sampling clock FOSC/64
ADCON2 = 0b10011000;
SetChanADC(ADC_CH0);
ConvertADC();
while(BusyADC());
PIR1bits.ADIF = 0; //clear ADC interrupt flag
low = ADRESL;
high = ADRESH;
waiting to hear from you
thanks