Page 1 of 1

Selecting a 2.048V reference voltage in PIC16F15324

Posted: Thu Feb 07, 2019 9:04 am
by Lagoda
Hi Ben,

I would like to use the ADC module of PIC16F15324 MCU .
The Vdd of the circuit is 3.3V.
I set the reference voltage source to the FVR on the AD Properties tab.
I inserted the following line in C code: FVRCON = 0x82; to select the 2.048V internal reference source. But is not working.
Based on the result of the AD conversion, the reference voltage is always 3.3V and I can't change it, but I really want it. :)

Can you help me?

Best regards,

Lagoda

Re: Selecting a 2.048V reference voltage in PIC16F15324

Posted: Thu Feb 07, 2019 11:06 am
by Benj
Hello,

I've found the bug and I'll push a fix to the v8 update system for you tomorrow.

If you want the fix today then you can apply it yourself by going here. "C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC"

Open the file "PIC_CAL_ADC.c" in a text editor and find line 6356, it should look like this.

Code: Select all

			ADCON0 = ADCON0 | Vref;				//Mod to allow FVR as VREF
Change the 0s to 1s and save the file.

Code: Select all

			ADCON1 = ADCON1 | Vref;				//Mod to allow FVR as VREF
Hope this helps.

Re: Selecting a 2.048V reference voltage in PIC16F15324

Posted: Thu Feb 07, 2019 12:34 pm
by Lagoda
Hi Ben,


Thanks for the quick response.
I made the change and restarted the Flowcode.
Unfortunately, the situation is the same as before.

Maybe the value from the Vref variable does not come from the properties tab?

Do you have any ideas yet?

Re: Selecting a 2.048V reference voltage in PIC16F15324

Posted: Thu Feb 07, 2019 12:55 pm
by Benj
Hello,

I checked the value passed from the ADC properties and this looks correct. i.e. 3 for FVR. Not sure what else could be at fault here? You didn't do an update did you after restarting Flowcode as this will revert the CAL ADC file back to stock.

Re: Selecting a 2.048V reference voltage in PIC16F15324

Posted: Thu Feb 07, 2019 1:04 pm
by Lagoda
Hi,


I didn't update, because it was up to date.

Re: Selecting a 2.048V reference voltage in PIC16F15324

Posted: Thu Feb 07, 2019 2:09 pm
by Lagoda
I've tried the next change in PIC_CAL_ADC.c, but the situation hasn't changed.
CAL_ADC_mod.jpg
CAL_ADC_mod.jpg (18.27 KiB) Viewed 3462 times
Does this help you?

Re: Selecting a 2.048V reference voltage in PIC16F15324

Posted: Fri Feb 08, 2019 9:06 am
by Lagoda
Hello Ben,

For now, this seems to be a paranormal phenomenon.
On another desktop PC, the unchanged project file produces a hex file without error and the MCU works correctly.
On this machine is same Flowcode version 8.1.1.11 , but it is not completely up to date.
I don't understand. :roll:

Best regards,

Lagoda