# What is the formula to convert the result of an 8-bit ADC to voltage?

I'm just struggling with one of the questions in my Computer Hardware assignment.

An 8-bit A-D conversion chip is configured to sense a voltage in the range 0 to 6V. Given an analog input voltage of 2.5V, determine, showing full working, what the 8-bit digital output should be.

So, using formula given by professor solution is:

2^8 = 256 so (2.5/6)/255 ≈ 0.002V

But, when I did some extra research, I found a different formula:

(2.5/6) * 255 = 106.25

So, which formula is correct and why?

• The generic form is $\frac {V_{in}} {V_{span}} * 2^n-1$ where n is the number of bits in the converter. Mar 4 '20 at 15:30
• (2.5/6)/255 = 0.002V ? I can't figure out what your professor is trying to say. Is this relation correct dimensionally? Mar 4 '20 at 15:33
• It's more likely you mixed up two formulae. "Which one is right"? Seems obvious on the face of it--how would an answer of 0.002V make sense when asking for an 8-bit digital output be?! Mar 5 '20 at 13:35

(2.5/6)*255=106.25 is the correct formula.

You can check with:

• sensed 0 => code 0
• sensed 6V => code 255

and 2.5V is just above 1/3rd of the way, so code 100 of 255 looks correct (255/3 = 85)

6/255 = 0.0235 also has a meaning, it's the V/code value, to get back the sensed value from the code (106*0.0235 = 2,491V)

The answer given by your professor looks incorrect to me. 2.5V/6V is a unitless quantity. Dividing it by constant should give you a dimensionless result. So, its a incorrect formula.

Second formula is correct because:

6V gives 255 ==> 1V gives 255/6 ==> 2.5V gives (255/6)*2.5. Unitary method holds!!

I like to do the dimensional analysis, I think it helps understand the answer: 8 bit -> 2^8 combinations(bits ADC-Counts) = 256

that gives 6V/256 bits ADC-Counts or 23.4mV per bit ADC-Counts or 256bits ADC-Counts / 6v is 42.66 bits ADC-Counts per volt

So we want the value for 2.5V

2.5V * (42.66 b ADC-Counts/v) = 106bits

backwards 106 bits ADC-Counts * (23.4mV/bit ADC-Counts) = 2.48v

• "2.5V * (42.66 b/v) = 106bits" you mean the binary representation of 106 (decimal), right? Mar 4 '20 at 2:17
• changed from bits to "ADC-Counts" hopefully that makes more sense
– BAO
Mar 4 '20 at 14:52