how i convert original to value

Discussion in 'Embedded Systems and Microcontrollers' started by gobi615, Feb 7, 2012.

  1. gobi615

    Thread Starter Member

    Jul 26, 2011
    30
    0
    my doubt is we giving input voltage 5 volt to adc and it converts it to digital range from 0 to 1023 for 10 bit resolution , how i convert to original value (before step down value) to display in lcd ..
     
  2. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    To display the voltage as 0 to 500 (0 to 5v) you can try this;
    Code ( (Unknown Language)):
    1.  
    2. unsigned int volts;
    3. unsigned long math;
    4. math = adc_value;    // 0-1023 range
    5. math = (((math * 500)+512) / 1024);  // convert 0-1023 to 0-500 with +/- rounding
    6. volts = math;
    7. display_with_dp(volts);  // display 500 as "5.00"
    8.  
     
  3. gobi615

    Thread Starter Member

    Jul 26, 2011
    30
    0
    thank you Mr THE_RB ..
     
Loading...