how i convert original to value

Thread Starter

gobi615

Joined Jul 26, 2011
30
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 ..
 

THE_RB

Joined Feb 11, 2008
5,438
To display the voltage as 0 to 500 (0 to 5v) you can try this;
Rich (BB code):
unsigned int volts;
unsigned long math;
math = adc_value;    // 0-1023 range
math = (((math * 500)+512) / 1024);  // convert 0-1023 to 0-500 with +/- rounding
volts = math;
display_with_dp(volts);  // display 500 as "5.00"
 
Top