Internal Voltage Reference_Solved!

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Benj »

Hello Uli,

That's great glad you made some progress. Yes that looks like a good way of doing it to me. You could customise the code for the ADC channels so that it automatically called the correct voltage before sampling if you wanted.

i.e.

ADC0 Read As Int would start with

fvrcon=0x82;

and ADC1 Read As Int would start with

fvrcon=0x83;

This way you can just sample the channel and the correct voltage will be assigned automatically.

If the datasheet doesn't mention the extra voltage setting then my guess is it may be for something else. Maybe the comparator module? I think the ADC module needs a fair amount of voltage to allow it to resolve the input voltage.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Creative25 »

Hi Benj,
If i change settings.
fvrcon=0x83; etc.
Does it get stored in internal memory or is it just loaded into ram.
Can I change these settings unlimited while running the program?

Another question.
If i have a reference voltage of 2.048 volts on vfr.
And the input gets higher than this but is not bigger than the supply voltage does the chip get damaged?
What rating diode should I use?
Best Regards:
Uli

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Benj »

Hello Uli,
If i change settings.
fvrcon=0x83; etc.
Does it get stored in internal memory or is it just loaded into ram.
Can I change these settings unlimited while running the program?
It is loaded into the RAM location in charge of holding the state of the fvrcon register. Yes you can write to registers as often as you like in your program.
If i have a reference voltage of 2.048 volts on vfr.
And the input gets higher than this but is not bigger than the supply voltage does the chip get damaged?
What rating diode should I use?
Hm this may have potential to damage the chip or the ADC module on the chip. I would refer to the device datasheet and see if you can find any info regarding this. Could you maybe use a in line series resistor and a reversed biased zener to limit the voltage that can be transferred into the input pin.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Creative25 »

Hi Benj
Thanks for the answer.
I am actually planning to use a serious register and a zener diode.
Just wonder what is the best place to put it.
I have a incoming voltage of maximum 30 volts and would have a voltage divider probably one 15K and one 1k resistor.
Should I put the zener diode between the two resistors or should I place it before the voltage divider and use an extra resistor?
Best Regards:
Uli.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Benj »

Hi Uli,

I would probably do it something like this. Because the ADC pin is high impedance the zener and series resistor will not consume any current/voltage until close to the cutoff voltage so maybe watch your readings for accuracy near the top end of the scale.
Untitled-1.gif
Untitled-1.gif (1.7 KiB) Viewed 7232 times
The series resistor should limit the current enough so that the zener will not blow when pulling down any excess voltage.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Creative25 »

Thanks Benj.
I also posted my question on the Microchip forum.
I will come back when I have an answer from them what the maximum Input voltage is with Fvr 2.048V
Where would a put in input filter capacitor?
Parallel to the zener diode, or at vin?
Uli

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Benj »

Hello Uli,

Probably best to place the smoothing cap across the source voltage, eg at Vin.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Creative25 »

Hi Benj
What do you mean by Vin?
Is it the place from where the voltage to be entered is taken from ,or is it the adc input?
Thanks
Uli

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Benj »

Hi Uli,

Vin as marked on the diagram :D

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Creative25 »

Thanks I did not realize you talk about the diagram.
Uli

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Creative25 »

Hi
Some time ago I posted a question if it will damage the chip if I would use FVR 2.048 on an ADC and the voltage is more than that but less than VDD
apparently you can go maximum 0.3 volts higher than VDD without damaging the Chip but or coure it can not show more than 2.048 volts.
Best Regards:
Uli

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Internal Voltage Reference_Solved!

Post by Benj »

Great thanks for letting us know.

Nice to know the ADC can't be damaged by enabling a reference voltage in software that is lower then the incoming voltage on the analogue pin.

Post Reply