Possible PIC16F1713 ADC Vref bug

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
qwall
Posts: 7
Joined: Tue Apr 18, 2017 1:57 am
Location: Los Angeles, CA
Has thanked: 4 times
Been thanked: 2 times
Contact:

Possible PIC16F1713 ADC Vref bug

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

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Possible PIC16F1713 ADC Vref bug

Post 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.
Attachments
PIC_CAL_ADC.c
(118.62 KiB) Downloaded 163 times

Post Reply