Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ADC integer to volt conversion

Status
Not open for further replies.

syedshan

Advanced Member level 1
Advanced Member level 1
Joined
Feb 27, 2012
Messages
463
Helped
27
Reputation
54
Reaction score
26
Trophy points
1,308
Location
Jeonju, South Korea
Visit site
Activity points
5,134
Dear all,

This must be the simplest question for an electronic engineer, but I cannot find the correct answer...

I am using 14 bit ADC to acquire data and the data is acquired correctly but I am capturing the
data through C++ code and hence capturing it in 16-bit short integer with left justified.

Now the problem is I have to convert it back to the volts and I think if I divide by 2^15 (MSB is sign bit).
but the value that I get is not correct.

Any experience for this conversion.

Note the ADC is AD62p49 from Texas instrument
 

i would say that your integer value IS your volts, except that it is in a binary formated number. Without reading the specs of your ADC, i'm not sure how you decided that MSB is a sign bit.

What exactly do you need to do with this volts-in-signed-binary-formatted-number ? depending on that, we can work out how to handle it. dividing with 2^15 will give you a 0 or 1 answer, which is obviously not what you want.
 

There are several things you need to know in order to do your number conversion:
1) Is the ADC output 2's complement or offset binary?
2) What is the ADC gain setting?
3) What is your ADC reference voltage?
4) Since you've left-justified your data, you've essentially multiplied it by 4, you need to take that into account as well.
 

Thank you for prompt reply Kripacharya

Just as a sample value please see the following acquired data (only small part of whole data which include both -ve and +ve values,

-312
-300
-284
-240
-204
-204
-196
-152
-144
-116
-68
-88
-52
-44
-20
0
32
28
48
64
72
80
100
88
88
88
100
120
88
88
84
96
72
64
68
48
48
40
-12
-24
-40
-32
-48
-68
-88
-120
-144
-136
-176
-224
-188
-236
-232
-268
-268
-284
-308
-328
-340
-356
-336
-372
-368
-392
-388
-408
-412
-408
-408

Without reading the specs of your ADC, i'm not sure how you decided that MSB is a sign bit.
The input that I take through ADC is in 2' compliments form that you can believe me :smile:

What exactly do you need to do with this volts-in-signed-binary-formatted-number ? depending on that, we can work out how to handle it. dividing with 2^15 will give you a 0 or 1 answer, which is obviously not what you want.
I want the final output in the Volts form. i.e. for example 0.002 volts etc.

Bests,
Shan
 

I want the final output in the Volts form. i.e. for example 0.002 volts etc.

seems reasonable :smile:

but i can't seem to find details of your ADC chip. can you post this ?
Also a circuit diagram of how you have setup your reference volts/ current, and what your expected input range is, will help a lot in giving a decent answer.
 

Kripacharya and Barry, thank you for response.

Well the ADC model is AD62p49. Actually I am using the FMC card where ADC is built in with the card, so I cannot send you the circuit diagram.
Please see the image attached at bottom of this post

Barry: Thank you for your reply.

1) Is the ADC output 2's complement or offset binary?
2) What is the ADC gain setting?
3) What is your ADC reference voltage?
4) Since you've left-justified your data, you've essentially multiplied it by 4, you need to take that into account as well.

Yes I kept in mind about the 2 points like 2's compliment and point 4....but did not kept in mind about point 2 and 3 at all...
I will look into it as. Well is it really important to look at ADC reference voltage since I do not have the much clue about it...will read about it now...

1.PNG
 

Well is it really important to look at ADC reference voltage since I do not have the much clue about it...will read about it now...

View attachment 85522

The reference voltage is key, you can't ignore it (as shown in post #5). The full-scale output code is directly related to the reference voltage.

- - - Updated - - -

A simple test would be to apply a known voltage and see what comes out the other end. You should be able to determine all your scaling factors from that. (It actually doesn't matter, for example, if you have a Vref of 5 and gain of 25, or a Vref of 2 and a gain of 10, your conversion factor will be the same)
 

Dear all,

This must be the simplest question for an electronic engineer, but I cannot find the correct answer...

I am using 14 bit ADC to acquire data and the data is acquired correctly but I am capturing the
data through C++ code and hence capturing it in 16-bit short integer with left justified.

Now the problem is I have to convert it back to the volts and I think if I divide by 2^15 (MSB is sign bit).
but the value that I get is not correct.

Any experience for this conversion.

Note the ADC is AD62p49 from Texas instrument

ADCs essentially return the ratio of Vin / Vref, so if Vin=Vref the value in the ADC is typically all 1. After dividing by 2^15 you would then need to multiply by Vref which should be a constant voltage set on the board. This kind of assumes that the input voltage is in the range 0-Vref. If instead your voltage is +/- (i.e. in the range of -Vref to +Vref) then you need to interpret the 14 bit word you receive back as a signed number. But in the end the steps are virtually the same. The points that you were missing are:
- The A/D value represents a number from 0-1 (or -1 to +1). So you need to divide by the appropriate power of 2
- The A/D value represents the ratio of Vin/Vref so it is dimensionless. To compute Vin, you need to multiply the number you obtain from the previous step by Vref which will be in the units of Vref (i.e. Volts).

Kevin Jennings
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top