ADC Math - reading 30Vdc


Results 1 to 13 of 13

Threaded View

  1. #1
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305

    Default ADC Math - reading 30Vdc

    I have a little project where I need to read 0 - 30Vdc. I've used a 100K /10K divider to give a max of 3V into the ADC pin.
    My Vref is 5.000V and I'm using a 10bit ADC.

    5/1024 = 0.0048V per count

    3V = 625
    625x48 = 30000

    How do I get a count of 625 to display as 30.00V?

    Code:
    ADCIN 1, LEDCOUNT
    LEDVOLT = LEDCOUNT * 48 
    LEDV0 = LEDVOLT/10
    LEDV1 = LEDVOLT//10         
     
    PAUSE 200
     
    LCDOUT $FE,1, "LED VOLTS ", DEC2 LEDV0, ".", DEC1 LEDV1, "V"
    This gives me a display of xx.xV not xx.xxV
    Last edited by jmgelba; - 8th April 2011 at 15:11.

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