Analog to Digital Converters (A/Ds) |
The Effect of Number of Bits
The number of bits used in the counter
also affects the accuracy of the conversion. Again, we will use a simulation to
show the effect of the number of bits.
We can think a little bit about error in an A/D. First, note that the error
limit depends upon the range and the number of bits.
If there are N bits, the
number of divisions is 2N-1.
If the total range of voltage
is VRange, then the size of a division is:
The error is related to the
Division size.
If the calculated voltage
is SmallestDivision*Count, the error is the same size as the smallest
division.
If the calculated voltage
is SmallestDivision*Count + SmallestDivision/2, the error is
SmallestDivision/2, i.e. half the size of the smallest division.
See the simulations above
for a better appreciation/understanding of the error.
We're not going to give you any more
simulators with more bits. Actually, we've almost reached the resolution limit
for the screen. The simulators with the "nudge buttons" just nudge the controls
by a single pixel, and that is too much for a twelve bit converter, for example.
Example
E3
A popular A/D board gives a count and requires you to perform the computation
shown in the line of C code shown below. The variable binary is the count value
that is returned.
MeasuredVolts =
(((binary-2048)*20)/4096);
The A/D converts voltages from
-10v to +10v. We can conclude the following.
Let's sum up a few points.
More is better when it comes
to bits in an A/D. The indicated voltage will be closer to the actual value
of the voltage being measured when there are more bits.
More is pricier when it comes
to bits in an A/D. It takes more parts, and they have to be made more
accurately if there are more bits.
How Does An A/D Work?
While we have discussed A/D converters
above, we haven't yet given you any insight into how you could build an A/D.
Here we will discuss a simple way to build an A/D. This might not be the
fastest A/D possible, but it will start to give you some insight into what
happens inside an A/D.
The circuit is shown in the simulator
below.
Simulator - Showing How You Might
Construct An A/D
Sim 5
This simulator is a four bit A/D, and it consists of the following components.
A pulse generator that
produces a sequence of 0's and 1's.
A counter which counts the
pulses and produces an increasing count.
A D/A which produces an
analog signal proportional to the count output from the counter.
An adjustable input voltage
source.
A comparator which produces a
"1" when the D/A output is larger than the input voltage.
Here is how the A/D
Simulator works.
First, set a DC voltage from
the adjustable source.
Second, click the "Convert"
button.
The counter begins
counting, and the count is displayed on the LEDs and the numerical value
of the count is displayed.
The digital count signals
(four bits of signals in this case) form the input to a D/A converter
which produces an output voltage proportional to the count.
The output voltage from
the D/A is compared to the input voltage.
When the output voltage
from the D/A becomes larger than the input voltage the comparator
develops a "Stop" signal that is used to stop the counter.
The count that remains in
the counter is a digital representation of the input voltage.
Try the simulator, using
different voltages within the allowable range, i.e. 0-5v.
The simulator lets you see
the inner workings of one type of A/D converter. Note the following about any
A/D converter.
The conversion takes time.
In the simulator, there is a variable amount of time until the counter
reaches the correct count. We have slowed down the simulator so you can see
what happens, but even in the best A/Ds there is some time that must elapse
between the start of a conversion and the end of a conversion. That time
limits how many conversions can be done per second. People have worked on
that problem and there are other kinds of converters that convert more
quickly.
The conversion is not exact,
and the accuracy depends upon the number of bits in the counter.
The result of the conversion
is an integer, and that integer still must be translated into an equivalent
voltage (although the conversion isn't hard to do).
Practical A/Ds
Now, consider what happens
in a typical application of an A/D. We'll look at a voltmeter. In a voltmeter,
this is what happens.
A voltage is applied to the
voltmeter, and an A/D converts the voltage to a count.
The count is converted to a
floating point number.
The floating point number is
displayed on an LCD or LED display.
If the voltmeter is connected to a
computer (say through an IEEE-488 bus) the following also takes place.
You can see that there are a few conversions
that have to take place in this process. There are a number of other
considerations here as well.
The number of bits in the A/D
converter will affect the accuracy of the voltmeter. There is a lot of
legend and lore in that area.
You need to be aware of how
to make conversions. Actually, you need to become knowledgeable about the
different representations as well as how to program those conversions in
various programming environments like C, C++, Visual Basic and LabView.
A/D converters are found in many places -
including places where you might not think that you would find them. Here are a
few.
Voltmeters are digital
today. To display a digital result for a voltage measurement the voltage is
first converted to digital form in an A/D, and then it is changed to a
decimal format to be displayed.
A/Ds are used in digital
thermometers, so if you've spent some time in the hospital, you've used an
A/D.
And, you get the idea.
However, there is an important situation
where you need to dig deeper into how A/Ds operate, and how they interface with
the software and hardware that is often used in measurement and control
situations. Let's think about a few typical situations.
Assume that you are recording
temperature at four points in a heat-treating oven. You need to do the
following.
You have three tanks used for
chemical processing. You need to control the level of the liquid in the
three tanks. Each tank has a small computer with an A/D board that measures
and controls the liquid level in each tank and also measures the
temperature. Each computer has a network card that connects it to an
Ethernet LAN. There is a central computer on the LAN and you need to send
information from each of the control computers to the central computer.
In both of these situations you need to
consider how to manipulate the data that you measure and want to store. Here
are some of the considerations.
If you take data with an
instrument connected to a computer (like a data acquisition unit or a
voltmeter) the instrument may be connected to the computer with an IEEE-488
(GPIB) connection.
If you send data over a
network, you must send strings of characters.
The conclusion that you need to reach is that
you need to be aware of how data has to be converted in these kinds of
situations. Let's look at the sequence of operations you might face.
The A/D converter gets
some raw data or information and it is in the form of an
integer count. Often it
is simply a binary number represented with some fixed number of bits.
The count could be a
number like 10001000 (or 129 in decimal numbers).
If the A/D converter has
eight (8) bits or less, the data will take a single byte.
If the A/D converter has
more than eight bits (which is typical) the data will take more than one
byte. Usually, for most converters, the data will take two bytes, since
most converters are 10, 12 or more bits.
The count is converted
to a number that represents the voltage (or possibly some other physical
variable). That takes some computer code (And there will probably be some
sort of computing chip in the instrument.) and the process results in a
number that is probably a floating point number.
If you transmit that floating
point number you need to generate a string of characters.
The string of characters
might be something like a "3", a period ("."), a "1", a "4", etc.
In many cases you may
need to add one or more characters to signal the end of a string. That
could be a carriage return and a line feed, for example.
|