Page 1 of 1

Possible PIC16F1713 ADC Vref bug

Posted: Thu Sep 07, 2017 6:29 pm
by qwall
I think there might be a bug for the Vref selection in the PIC_CAL_ADC.c file for ADC Type 26 devices.

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;
		}
Altering the case assignment, the ADC results appear to be correct.

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;
		}

Re: Possible PIC16F1713 ADC Vref bug

Posted: Mon Sep 11, 2017 12:05 pm
by LeighM
Hi,
Thanks for spotting that.
There's been a clash with FCD updates for FVR support.
Please use the attached updated CAL file.