I am using the FVR as my ADC reference. If I select FVR as the reference, the ADC results are incorrect. However, if I select Vref+ as the reference, the ADC results are correct.
I think the case assignment might be incorrect.
Code: Select all
switch (Vref)
{
case 1: // Vref selected
ADCON1 |= 2;
break;
case 2: // FVR selected
ADCON1 |= 3;
FVRCON |= 0x81; // ADC FVR output is enabled, 1x (1.024V)
break;
default: // VDD selected
break;
}
Code: Select all
switch (Vref)
{
case 2: // Vref selected
ADCON1 |= 2;
break;
case 3: // FVR selected
ADCON1 |= 3;
FVRCON |= 0x81; // ADC FVR output is enabled, 1x (1.024V)
break;
default: // VDD selected
break;
}