O'Reilly logo

Microcontroller Programming and Interfacing Texas Instruments MSP430 by Daniel J. Pack, Steven F. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

244 8. ANALOG PERIPHERALS
crossing a street with your eyes closed but can open your eyes momentarily at a fixed rate. If there
is no traffic, you can cross the street without opening your eyes since no changes will occur during
your crossing. The other extreme case is when you try to cross the road during a heavy traffic time.
If you do not open your eyes often - high sampling rate - you may be risking your life.
You may wonder what harm does it cause to sample at the highest frequency possible regardless
of the frequency content of the analog signal? The answer lies on the resource optimization. Just
as it would be a waste to take multiple pictures of the same static object, it would not be a good
use of resources to sample with a high frequency rate regardless of the nature of an analog signal.
In the 1940’s, Henry Nyquist, who worked at IBM Bell Laboratory, developed the concept that
the minimum required sampling rate is a function of the highest input analog signal frequency:
f
s
2 × f
h
. The frequency f
s
and f
h
are the sampling frequency and the highest frequency of
the signal we want to capture, respectively. That is, the sampling frequency must be greater than or
equal to two times of the highest frequency component of the input signal. Using the illustration of
taking pictures again, the rate that you take a sequence of pictures must be at least two times as fast as
the highest frequency of changes in the environment of which you are taking pictures to reconstruct
the ’signals’ in the environment. We illustrate the Nyquist sampling rate using Figure 8.2.
Figure 8.2 shows the analog signal of interest, a sinusoidal signal. Frame (b) of the figure shows
sampling points with a rate slower than the Nyquist rate and frame (c) shows the reconstruction of
the original signals using only the sampled points shown in frame (b). Frame (d) shows the sampled
points at the Nyquist rate and the corresponding reconstructed signal is shown in frame (e). Finally,
frame (f ) shows sampled points at a rate higher than the Nyquist sampling rate and frame (g) shows
the reconstructed signal. As can be seen from this simple example, when we sample an analog signal
at the Nyquist sampling rate, we can barely generate the characteristics of the original analog signal.
While at a higher sampling rate, we can retain the nature of an input analog signal more accurately
at a higher cost, requiring a faster clock, additional processing power, and more storage facilities. Let
us examine one final example before we move on to the quantization process.
Example: An average human voice contains frequencies ranging from about 200 Hz to 3.5 kHz.
What should be the minimum sampling rate for an ATD converter?
Answer: According to the Nyquist sampling rate rule, we should sample at 3.5 kHz x 2 = 7 kHz,
which translate to taking a sample every 142.9 usec. Your telephone company uses sampling rate of
8 kHz to sample your voice so that it can be delivered to a receiver.
8.3.2 QUANTIZATION
Once a sample is captured, then the second step, quantization, can commence. Before we explain the
process, we first need to define the term quantization level. Suppose we are working with an analog
voltage signal whose values can change from 0V to 5V. Now suppose we pick a point in time. The
analog signal, at that point in time, can have any value between 0 V and 5 V, an infinite number of
possibilities (think of real numbers). Since we do not have a means to represent infinitely different
8.3. ANALOG-TO-DIGITAL CONVERSION 245
0
2
4
6
8
1
0
2
4
6
8
1
0
2
4
6
8
1
0
2
4
6
8
1
(a) (b)
(c)
(d)
(e) (f)
(g)
Figure 8.2: Sampling rate illustration.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required