I am working with a 16-bit differential ADC and I would like to know the difference between this latter and a single ended ADC especially: How to calculate voltage from the ADC value ?

Is it like this:

Voltage = IN- + Vref x Code/2^n-1

EDITED: According to the datasheet, the ADC gives a two's complement value. How to calculate voltage from this value ?

  • \$\begingroup\$ Usually the output format is in 2's complement. \$\endgroup\$ – Long Pham Aug 9 '18 at 13:33
  • 1
    \$\begingroup\$ From data sheet page 16: For example, the size of one LSB is equal to [(2 x VREF) / 2^n], which is 152.6 μV where n is 16 bits and VREF is 5V. And as LongPham has said, 2's complement format \$\endgroup\$ – glen_geek Aug 9 '18 at 13:55
  • \$\begingroup\$ How to convert this 2's complement value to a voltage? \$\endgroup\$ – Pryda Aug 9 '18 at 14:29
  • \$\begingroup\$ I edited my question \$\endgroup\$ – Pryda Aug 9 '18 at 14:57
  • \$\begingroup\$ 2's complement is the standard way to represent a number that can go positive or negative. Just make sure the Voltage variable is a signed integer, and it will give you a positive/negative voltage. No conversion required. The formula you provided is correct. \$\endgroup\$ – Oliver Aug 9 '18 at 15:03

Differential or single ended has nothing to do with your conversion.

Differential: Voltage being converted to is (In+)-(In-)

Single Ended: Voltage being converted to is Vin

int16_t code=read_ADC(); 
float voltage=code*Vref/(2^16-1)

n bit devises the range to (2^n-1) "buckets", so each bucket is Vref/(2^n-1)

  • \$\begingroup\$ (2^n -1) vs (2^n). Never-ending controversy ;) \$\endgroup\$ – Long Pham Aug 10 '18 at 4:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.