Didn't find your answer? Ask the community — no account required.
M
Mark Borgerson
Has this hardware guy even read the data sheet on the converter? I'll assume that you both KNOW that it is an 8-bit unipolar converter.
You'd better precede all these with: if(V_IN > V_REF) V_IN = V_REF;
in C, I usually define N as an unsigned character, and don't bother with the floor() function.
The behavior and transfer functions for A/D converters can be found in their data sheets. Generally, the first transition (from 0 to 1) occurs at 1/2 the voltage step represented by 1 LSB, so adding the
+0.5 would seem to be appropriate.
If you are spending a lot of time worrying about behavior near the limits, you need to talk to the hardware guy. When the output is either zero or 255, there is always the possibility that the real input value was either less than zero or greater than full scale. If you include those in sample statistics you can get a bad result. Imagine a signal that, due to noise, bounced around equally between -1 counts and +1 counts. The output from the converter would be either zero or 1, but the average would be positive. If there is more than 1LSB of noise, the bias gets worse.
In between 0 and 255, you need to read up on ADC specs like integral non-linearity.
If you ever get all zeroes or all 255's from your converter, you have a problem! All you can tell is that the signal is = Full Scale - 1/2LSB. The actual input voltage could be ready to let the magic smoke out of the converter!
Mark Borgerson
D
David T. Ashley
Hi Mark,
Yes, we've both read the data sheet. All it says is that the converter is -/+ 1 count. The transfer function is not mentioned.
Thanks for your reply, Dave Ashley.
G
Guy Macon
I advise splitting your 5V into 250 counts if the way the references work allows it. Put the 2 to 3 transition right at 0V and put the
252 to 253 transition right at 5V. Yes, you lose a tiny bit of resolution, but you gain the ability to use a small amount of software averaging without getting different results near the endpoints, and a nice clean scaling job when you display the results in digital form.
M
Mark Borgerson
Aaarggh. I would have little faith in a converter with documentation that poor! I hope it wasn't from Burr-Brown(TI) or Analog Devices. Their ADCs usually have at least a page on the transfer function and errors. But then I use primarily 16-bit or higher resolution ADCs and they may spend more time on the documentation on those parts.
Mark Borgerson
M
Mark Borgerson
That sounds more like something you would do with an offset and scaling of the input. The problem there is that you may have to do a calibration to get the real offset and scaling factors. That is ok if you're building a handful of scientific instruments (which is what I usually do), but might be cost-prohibited in higher volume applications.
Mark Borgerson
G
Guy Macon
In a high-volume application without calibration, you need to put even more slop at the endpoints. Keeping the input signal away from the endpoints is an excellent way to do that. The question then becomes one of calculating yourverror budget.
M
Mark Borgerson
Well, with 5V FS and an 8-bit converter, you get about 20mV per LSB. That makes the selection of components to stay 10LSB away from the limits a bit easier than is the case with a 16 or
24-bit converter! But then with more resolution, you can afford to give up a few more LSBs.
That attention to endpoints (or lack of attention) used to be quite common in the old analog joysticks. You would often see no change at all for about 1/4 the physical motion range at either end.
Mark Borgerson
C
CBFalconer
... snip ...
Nominally only, for bipolar converters. Converters may also have guaranteed monotonicity (but need not) and may have specifications for differential linearity, which has to do with the "window size" of input values that appears for each output value.
Unipolar converters will usually have their first nominal transition at the full voltage step.
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
Available for consulting/temporary embedded and systems.
USE worldnet address!
E
Endymion Ponsonby-Withermoor III
What does "monotonicity" mean in this context, that each "number" from the A/D converter is reachable, the same as "no missing codes" ?
Or does it mean that the A->D transfer is a strictly increasing function ?
Richard [in PE12]
R
Robert Scott
Usually it means "no missing codes" which implies a strictly increasing A->D function. But if there are missing codes, that may or may not mean that the A->D function is monotonic, depending on which code is missing. For example, if all the odd numbered codes were missing, then the function could still be monotonic.
-Robert Scott Ypsilanti, Michigan (Reply through this forum, not by direct e-mail to me, as automatic reply address is fake.)
M
Mark Borgerson
Hmmm, I was looking at the data sheet for the AD7654, which shows the transitions at the 1/2 bit points. The converter measures 0 to 5V using a 2.5V reference. ( or 0 to 2*VRef if VRev < 2.5V). After reading Chuck's comment, I note that the data sheet does label the
0 to 1 bit transition as -FS + 0.5LSB. So maybe it is really a bipolar converter with a built-in offset of VRef. I guess that this means that it can be difficult to decide what is really a bipolar converter! You learn something new every day!
Mark Borgerson
R
R Adsett
My preference as well, It also allows a certain independance from A/D resolution (substituting a higer resolution A/D causes minimal disruption, obviously the reverse is not as painless)
After all why does the micro care if it's dealing in amp or .314159... amps?
Robert
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.