Display Vdd


Closed Thread
Results 1 to 8 of 8

Thread: Display Vdd

  1. #1
    Join Date
    Feb 2010
    Posts
    6

    Default Display Vdd

    Hi all. Newbie here so please be gentle. Using a 16F876 and 2.45a. Want to display Vdd on an up and running LCD. Can't figure it out. When displayed Vdd will then be adjusted to exactly 5 volts to be used as the reference to convert and display an input voltage through an ADC pin. A test 3 volt battery ADC input works well even to 3 decimal places but uses actual Vdd rather than 5 so this question.

    Am I on the right track or is there a better way to get a correct ADC voltage on screen? LCD Pics here. Should mention the 4 shown at right hand bottom is a toggle from 4 to 8 when you press the Ohms button. It's a relay for this project.

    Any help much appreciated. tks Dave.
    Attached Images Attached Images   

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,580


    Did you find this post helpful? Yes | No

    Default

    Not sure I understand... Have you connected Vdd to an analog pin or are you trying to somehow "internally" get a reading of it?

    If you're using Vdd as Vref for the ADC then it simply won't work because whatever Vdd is is also your refenrece for full scale ADC reading. You'd need to configure the ADC to use external Vref and have a stable voltage reference that doesn't change as the battery voltage goes down (voltage reference IC, zener diode, voltage regulator etc). Then you can use a resistor network to "scale" the voltage to withing the Vref- and Vref+ for the ADC.

    Does that make sense or did I completely miss the point?

    /Henrik.

  3. #3
    Join Date
    Feb 2010
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Display Vdd

    Hi Henrik.

    Thanks for the info. I would rather use the internal vRef which as you say moves with Vdd. So if I can adjust Vdd and so vRef to exactly 5 volts (from a mains variable supply) as the constant I can use the formula (ADC output/5) * 255 to display my readings. I can always set Vdd with a multimeter but as a learning exercise would like to do this through the Pic as well.

    Perhaps I should explain what I am trying to do which is to display on LCD variables between 0 and 30 volts AC. The AC input is rectified through a diode then a 10uf cap and a voltage divider. Maybe add a 4v7 zener for safety? - still to try that. So 0-30 VAC becomes 0-5 VDC. Then just a matter of scaling the readings by 6.

    Or is there more to it? Thanks Dave.

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    That might not be as easy as you state. 30 volts A/C is an RMS value, which is an average of all the voltage, the peak value of an AC 30v will be much higher, and you will see the rectified voltage will result in a much higher DC voltage than 30 VDC.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    Feb 2010
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Vdd display

    Thanks Joe.

    Yes of course you are right. The rectified voltage will be 1.414 times the AC voltage. And it measures accordingly. That's why I have a voltage divider built in and probably a zener after that to cover any cases where the AC goes over 30 volts.

    Any suggestions on how to do display Vdd/Vref ? Dave.

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,580


    Did you find this post helpful? Yes | No

    Default

    I may still be missing the point but if you want to measure and display Vdd, ie the PICs supply voltage, you MUST use an external, stable, source for Vref that does NOT "move" with Vdd, otherwise you will simply get the same reading all the time.

    Let's say your Vdd is 4.85V and therefor your Vref is 4.85V. A voltage of 4.85V on the analog inputs will now give you a full scale result (1023) from the ADC because 4.85V is what Vref is set to. Whatever you set Vref to is what will give you a full scale reading so as long as Vref=Vdd you can not measure and display Vdd with the ADC.

    /Henrik.

  7. #7
    Join Date
    Feb 2010
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Thjanks again.

    All received and well understood. But the original question remains : "how do you physically display the current value of Vdd on an LCD?"

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,580


    Did you find this post helpful? Yes | No

    Default

    Hi,
    But the original question remains
    And has been answered IMO.....
    You use some kind of voltage reference chip that produces a stable reference voltage over the whole operating range of your batteries. Let's say that voltage is 2.048V. You connect this reference voltage to the Vref pin on the PIC and set the ADC up to use that pin as Vref+ instead of Vdd.

    Now you create a resistor network between Vdd and Vss and choose the resisitor values so that the voltage over the lower resistor is as close to 2.048V as possible when the batteries are fully charged. You connect this "signal" to the analog input of your choise.

    Now the ADC will give you a reading of 2mV/count.

    There is no way to internally "connect" Vdd to an analog input - except to the Vref+ pin. And there is no way to do measure Vdd without using an external reference voltage.

    /Henrik.

Similar Threads

  1. Hdsp 21xx display
    By Original in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th June 2012, 21:07
  2. Replies: 2
    Last Post: - 14th July 2008, 23:11
  3. DS1820 display with 7-seg 4 digits
    By chai98a in forum Code Examples
    Replies: 12
    Last Post: - 10th April 2008, 14:12
  4. need help on display problem
    By sixty9sandals in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 30th March 2007, 04:57
  5. graphics display
    By adlinsystems in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th June 2004, 13:53

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts