Vref question

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Posts: 4
Joined: Tue Jan 17, 2006 3:27 am
Location: McPherson, KS USA

Vref question

Post by Edshere »

I'm not sure how to handle this little problem. My pic is running on batteries. Board full voltage is 5 volts. Vref is straight off of the +plane so, my vref is 5v. One of my functions is charging a pretty big capacitor. I have a voltage divider to make 400 volts to 1.2 volts which is on ADC. Pretty simple so far. I charge the cap until the A/D input gets to 61, then I shut off the output that charges the cap.

Two problems.
1. Like I said this runs off of batteries. When the batteries get low, the vref changes so, my A/D input value will change.
2. When I charge the cap, my voltage drops to somewhere between 3-4 volts. This also will change the A/D input value.

How can I acurately read 1.2 volts on A/D input with a floating vref. I really don't want to put a 1V voltage regulator on the Vref+ pin.

I thought about sampling the voltage before I start the charging cycle, but If I do that I will get a full scale value no matter what the voltage is.

Any ideas????

Ed Whitfield

User avatar
Matrix Staff
Posts: 3174
Joined: Tue Jan 03, 2006 3:59 pm

Post by Steve »

Hi Ed,

I moved your post to this forum because it is more applicable here.

As a suggestion, you could possibly use a Zener diode instead of a voltage regulator.

Also, depending on the voltage drop you are experiencing and your choice of Zener, you may be better off using the internal VRef signals (i.e. the chip power supply) and read both your A/D input and the Zener diode input at the same time. You will then need to do some calculations to work out the real A/D value, but it should be pretty accurate as long as the voltage drop of the power supply does not go near the Zener value.

Post Reply