A different look at the problem
5V at adc gives 1024 counts
3V at adc gives ??? counts
Counts for 3V = (1024 * 3)/5
Now, we want to find the voltage instead of counts of adc, so using the equality of ratios,
5V/3V = 1024/???
can also be stated as
5V/??V = 1024/Adc counts
V = (Counts for 5V / 1024)*Adc Counts
since you want V not as 0-3V but as 0-30.00 volts, we will multiply the result by 1000 and artificially put the decimal point in the result
V = (Counts for 5V/1024)*Adc Counts * 1000
This will yield a reading of 0000 to 3000 for an adc reading going from 0-614
You have to display the result by artificially putting the decimal point into the printed result.
Cheers




Bookmarks