ADC FVR (Fixed Voltage Reference)

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

ADC FVR (Fixed Voltage Reference)

Post by Jan Lichtenbelt »

I want to use the ADC Fixed Voltage Reference FVR in case of the 16F18857 microchip.
http://www.microchip.com/wwwproducts/De ... /documents
I choose a potentiometer as example for input of an ADC. There is a possibility to choose "FVR" as Vref option in the ADC macro.
But this chip has three possible FVRs: 1.024 V, 2.048 V or 4.096V. The ADC macro does not show which FVR will be choosen.
What to do?

Kind regards

Jan

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: ADC FVR (Fixed Voltage Reference)

Post by Jan Lichtenbelt »

In the meanwhile I found a solution by entering the c-code after the RawEnable macro:
//ADC Vref+=FVR=2.048 Volt
FVRCON= FVRCON | 0x82; // set bit 1 (FVR 2.048 V) and 7 (FVR enable)
FVRCON= FVRCON & 0xFE; // clear bit 0 (FVR 2.048 V)
This gives ADC values between 0-1024 for voltages between 0-2.48 Volt.

Kind regards

Jan

Post Reply