Selecting a 2.048V reference voltage in PIC16F15324

Moderator: Benj

Post Reply
Lagoda
Posts: 153
Joined: Fri Jul 15, 2016 9:51 pm
Contact:

Selecting a 2.048V reference voltage in PIC16F15324

Post 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

User avatar
Benj
Matrix Staff
Posts: 15049
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Selecting a 2.048V reference voltage in PIC16F15324

Post 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.

Lagoda
Posts: 153
Joined: Fri Jul 15, 2016 9:51 pm
Contact:

Re: Selecting a 2.048V reference voltage in PIC16F15324

Post 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?

User avatar
Benj
Matrix Staff
Posts: 15049
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Selecting a 2.048V reference voltage in PIC16F15324

Post 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.

Lagoda
Posts: 153
Joined: Fri Jul 15, 2016 9:51 pm
Contact:

Re: Selecting a 2.048V reference voltage in PIC16F15324

Post by Lagoda »

Hi,


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

Lagoda
Posts: 153
Joined: Fri Jul 15, 2016 9:51 pm
Contact:

Re: Selecting a 2.048V reference voltage in PIC16F15324

Post 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 1550 times
Does this help you?

Lagoda
Posts: 153
Joined: Fri Jul 15, 2016 9:51 pm
Contact:

Re: Selecting a 2.048V reference voltage in PIC16F15324

Post 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

Post Reply