A/D Behavior Question

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi,

A hardware guy came to me today and asked if 255/5 (or, more precisely,
255/V_REF) was the correct scaling factor to use to go from voltage to A/D
counts.  I said yes.

But then I got to thinking ...

... a simple expression like floor(255/5) seems to ignore the behavior near
255 and near 0.  How close to V_REF does the A/D converter change from 254
to 255?  Similarly from 0 to 1?  Is it a rounding function?

Any thoughts or practical experience about the subtleties of this behavior
near the endpoints?  Choices seem to be:

a)N = floor(255 * V_IN / V_REF)
b)N = floor(255 * V_IN / V_REF + 0.5).
c)Some other choice?

Thanks, Dave Ashley




Re: A/D Behavior Question
snipped-for-privacy@cequentgroup.com says...
Quoted text here. Click to load it

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.
Quoted text here. Click to load it


You'd better precede all these with:
if(V_IN > V_REF)  V_IN = V_REF;
Quoted text here. Click to load it
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 <= 1/2LSB or  >= Full Scale - 1/2LSB.   The actual
input voltage could be ready to let the magic smoke out of
the converter!

Mark Borgerson



Re: A/D Behavior Question
Quoted text here. Click to load it

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.




Re: A/D Behavior Question
snipped-for-privacy@aol.com says...
Quoted text here. Click to load it

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.
Quoted text here. Click to load it

Mark Borgerson


Re: A/D Behavior Question
snipped-for-privacy@amleth.demon.co.uk says...
Quoted text here. Click to load it
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)

Quoted text here. Click to load it
After all why does the micro care if it's dealing in amp or .314159...
amps?

Robert

Re: A/D Behavior Question

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.




Re: A/D Behavior Question
<http://www.guymacon.com says...
Quoted text here. Click to load it

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


Re: A/D Behavior Question

Quoted text here. Click to load it

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.



Re: A/D Behavior Question
<http://www.guymacon.com says...
Quoted text here. Click to load it

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
 

Re: A/D Behavior Question
Quoted text here. Click to load it
... snip ...
Quoted text here. Click to load it

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 ( snipped-for-privacy@yahoo.com) ( snipped-for-privacy@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
We've slightly trimmed the long signature. Click to see the full one.
Re: A/D Behavior Question

Quoted text here. Click to load it

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]



Re: A/D Behavior Question
On Fri, 15 Oct 2004 10:42:10 +0100, "Endymion Ponsonby-Withermoor III"

Quoted text here. Click to load it

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.)

Re: A/D Behavior Question
Quoted text here. Click to load it
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

Site Timeline