Laborator 2
Laborator 2
Preliminary discussion
So far, the experiments in this manual have concentrated on communications systems that
transmit analog signals. However, digital transmission is fast replacing analog in commercial
communications applications. There are several reasons for this including the ability of digital
signals and systems to resist interference caused by electrical noise.
Many digital transmission systems have been devised and several are considered in later
experiments. Whichever one is used, where the information to be transmitted (called the
message) is an analog signal (like speech and music), it must be converted to digital first. This
involves sampling which requires that the analog signals voltage be measured at regular
intervals.
Figure 1a below shows a pure sinewave for the message. Beneath the message is the digital
sampling signal used to tell the sampling circuit when to measure the message. Beneath that is
the result of naturally sampling the message at the rate set by the sampling signal. This type
of sampling is natural because, during the time that the analog signal is measured, any change
in its voltage is measured too. For some digital systems, a changing sample is unacceptable.
Figure 1b shows an alternative system where the samples size is fixed at the instant that the
signal measured. This is known as a sample-and-hold scheme (and is also referred to as pulse
amplitude modulation).
Figure 1a
13-2
Figure 1b
Regardless of the sampling method used, by definition it captures only pieces of the message.
So, how can the sampled signal be used to recover the whole message? This question can be
answered by considering the mathematical model that defines the sampled signal:
As you can see, sampling is actually the multiplication of the message with the sampling signal.
And, as the sampling signal is a digital signal which is actually made up of a DC voltage and
many sinewaves (the fundamental and its harmonics) the equation can be rewritten as:
When the message is a simple sinewave (like in Figure 1) the equations solution (which
necessarily involves some trigonometry that is not shown here) tells us that the sampled signal
consists of:
A pair of sinewaves that are the sum and difference of the fundamental and message
frequencies
Many other pairs of sinewaves that are the sum and difference of the sampling signals
harmonics and the message
This ends up being a lot of sinewaves but one of them has the same frequency as the message.
So, to recover the message, all that need be done is to pass the sampled signal through a lowpass filter. As its name implies, this type of filter lets lower frequency signals through but
rejects higher frequency signals.
That said, for this to work correctly, theres a small catch which is discussed in Part E of the
experiment.
The experiment
In this experiment youll use the Emona DATEx to sample a message using natural sampling
then a sample-and-hold scheme. Youll then examine the sampled message in the frequency
domain using the NI ELVIS Dynamic Signal Analyzer. Finally, youll reconstruct the message
from the sampled signal and examine the effect of a problem called aliasing.
It should take you about 50 minutes to complete this experiment.
13-3
Equipment
NI Data Acquisition unit such as the USB-6251 (or a 20MHz dual channel oscilloscope)
Procedure
1.
Ensure that the NI ELVIS power switch at the back of the unit is off.
2.
Carefully plug the Emona DATEx experimental add-in module into the NI ELVIS.
3.
Set the Control Mode switch on the DATEx module (top right corner) to PC Control.
4.
5.
Connect the NI ELVIS to the NI Data Acquisition unit (DAQ) and connect that to the
personal computer (PC).
6.
Turn on the NI ELVIS power switch at the back then turn on its Prototyping Board
8.
Once the boot process is complete, turn on the DAQ then look or listen for the
indication that the PC recognises it.
9.
10.
11.
Check you now have soft control over the DATEx by activating the PCM Encoder
modules soft PDM/TDM control on the DATEx SFP.
13-4
Note: If youre set-up is working correctly, the PCM Decoder modules LED on the
DATEx board should turn on and off.
12.
DUAL ANALOG
SWITCH
MASTER
SIGNALS
S/ H
S& H
IN
S&H
OUT
SCOPE
CH A
IN 1
1 0 0 kHz
SINE
1 0 0 kHz
COS
CH B
CONTROL 1
1 0 0 kHz
DIGITAL
CONTROL 2
8 kHz
DIGITAL
TRIGGER
2 kHz
DIGITAL
2 kHz
SINE
IN 2
OUT
Figure 2
This set-up can be represented by the block diagram in Figure 3 below. It uses an
electronically controlled switch to connect the message signal (the 2kHz SINE output from
the Master Signals module) to the output. The switch is opened and closed by the 8kHz
DIGITAL output of the Master Signals module.
Message
To Ch.A
Dual Analog
Switch
Master
Signals
IN
Sampled message
To Ch.B
2kHz
CONTROL
8kHz
Master
Signals
Figure 3
13-5
13.
14.
Set up the scope per the procedure in Experiment 1 (page 1-13) ensuring that the
Trigger Source control is set to CH A.
15.
Adjust the scopes Timebase control to view two or so cycles of the Master Signals
modules 2kHz SINE output.
16.
Activate the scopes Channel B input by pressing the Channel B Display controls ON/OFF
button to observe the sampled message out of the Dual Analog Switch module as well as
the message.
Tip: To see the two waveforms clearly, you may need to adjust the scope so that the
two signals are not overlayed.
17.
Draw the two waveforms to scale in the space provided on the next page leaving room to
draw a third waveform.
Tip: Draw the message signal in the upper third of the graph and the sampled signal in
the middle third.
Question 1
What type of sampling is this an example of?
Natural
Sample-and-hold
Question 2
What two features of the sampled signal confirm this?
13-6
13-7
18.
Before you do
The set-up in Figure 4 below builds on the set-up that youve already wired so dont
pull it apart. To highlight the changes that we want you to make, weve shown your
existing wiring as dotted lines.
MASTER
SIGNALS
DUAL ANALOG
SWITCH
S/ H
S&H
IN
100kHz
SINE
100kHz
COS
100kHz
DIGITAL
S&H
OUT
SCOPE
CH A
IN 1
CH B
CONTROL 1
CONTROL 2
8kHz
DIGITAL
TRIGGER
2kHz
DIGITAL
2kHz
SINE
IN 2
OUT
Figure 4
This set-up can be represented by the block diagram in Figure 5 on the next page. The
electronically controlled switch in the original set-up has been substituted for a sample-andhold circuit. However, the message and sampling signals remain the same (that is, a 2kHz
sinewave and an 8kHz pulse train).
13-8
Message
To Ch.A
Dual Analog
Switch
Master
Signals
IN
2kHz
S/ H
Sampled message
To Ch.B
CONTROL
8kHz
Master
Signals
Figure 5
19.
Draw the new sampled message to scale in the space that you left on the graph paper.
Question 3
What two features of the sampled signal confirm that the set-up models the sampleand-hold scheme?
13-9
20.
Disconnect the plugs to the Master Signals modules 2kHz SINE output.
21.
SEQUENCE
GENERATOR
MASTER
SIGNALS
DUAL ANALOG
SWITCH
S/ H
LINE
CODE
O
1
S&H
IN
OO NRZ-L
SYNC
O1 Bi-O
1O RZ-AM I
11 NRZ-M
X
100kHz
SINE
100kHz
COS
CLK
SPEECH
GND
GND
S&H
OUT
SCOPE
CH A
IN 1
CH B
CONTROL 1
100kHz
DIGITAL
CONTROL 2
8kHz
DIGITAL
TRIGGER
2kHz
DIGITAL
2kHz
SINE
IN 2
OUT
Figure 6
22.
23.
Hum and talk into the microphone while watching the scopes display.
13-10
Part C Observations and measurements of the sampled message in the frequency domain
Recall that the sampled message is made up of many sinewaves. Importantly, for every
sinewave in the original message, theres a sinewave in the sampled message at the same
frequency. This can be proven using the NI ELVIS Dynamic Signal Analyzer. This device
performs a mathematical analysis called Fast Fourier Transform (FFT) that allows the
individual sinewaves that make up a complex waveform to be shown separately on a frequencydomain graph. The next part of the experiment lets you observe the sampled message in the
frequency domain.
24.
25.
Disconnect the plugs to the Speech modules output and reconnect them to the Master
Signals modules 2kHz SINE output.
Note: The scope should now display the waveform that you drew for Step 19.
26.
Suspend the scope VIs operation by pressing its RUN control once.
Note: The scopes display should freeze.
27.
Figure 7
13-11
28.
FFT Settings
Averaging
Mode to RMS
Weighting to Exponential
# of Averages to 3
Triggering
Frequency Display
Note: If the Signal Analyzer VI has been set up correctly, your display should look like
Figure 8 below.
Figure 8
13-12
If youve not attempted Experiment 7, the Signal Analyzers display may need a little
explaining here. There are actually two displays, a large one on top and a much smaller one
underneath. The smaller one is a time domain representation of the input (in other words, the
display is a scope).
The larger of the two displays is the frequency domain representation of the complex
waveform on its input (the sampled message). The humps represent the sinewaves and, as you
can see, the sampled message consists of many of them. As an aside, these humps should just
be simple straight lines, however, the practical implementation of FFT is not as precise as the
theoretical expectation.
If you have done Experiment 7, go directly to Step 36 on the next page.
29.
The NI ELVIS Dynamic Signal Analyzer has two markers M1 and M2 that default to the left
side of the display when the NI ELVIS is first turned on. Theyre repositioned by grabbing
their vertical lines with the mouse and moving the mouse left or right.
30.
31.
The NI ELVIS Dynamic Signal Analyzer includes a tool to measure the difference in magnitude
and frequency between the two markers. This information is displayed in green between the
upper and lower parts of the display.
32.
Move the markers while watching the measurement readout to observe the effect.
33.
Position the markers so that theyre on top of each other and note the measurement.
Note: When you do, the measurement of difference in magnitude and frequency should
both be zero.
13-13
Usefully, when one of the markers is moved to the extreme left of the display, its position on
the X-axis is zero. This means that the marker is sitting on 0Hz. It also means that the
measurement readout gives an absolute value of frequency for the other marker. This makes
sense when you think about it because the readout gives the difference in frequency between
the two markers but one of them is zero.
34.
35.
Recall that the message signal being sampled is a 2kHz sinewave. This means that there should
also be a 2kHz sinewave in the sampled message.
36.
Use the Signal Analyzers M1 marker to locate sinewave in the sampled message that has
the same the frequency as the original message.
As discussed earlier, the frequency of all of the sinewaves in the sampled message can be
mathematically predicted. Recall that digital signals like the sampling circuits clock signal are
made up out of a DC voltage and many sinewaves (the fundamental and harmonics). As this is a
sample-and-hold sampling scheme, the digital signal functions as a series of pulses rather than
a squarewave. This means that the sampled signals spectral composition consists of a DC
voltage, a fundamental and both even and odd whole number multiples of the fundamental. For
example, the 8kHz sampling rate of your set-up consists of a DC voltage, an 8kHz sinewave
(fs), a 16kHz sinewave (2fs), a 24kHz sinewave (3fs) and so on.
The multiplication of the sampling signals DC component with the sinewave message gives a
sinewave at the same frequency as the message and you have just located this in the sampled
signals spectrum.
13-14
The multiplication of the sampling signals fundamental with the sinewave message gives a pair
of sinewaves equal to the fundamental frequency plus and minus the message frequency. That
is, it gives a 6kHz sinewave (8kHz 2kHz) and a 10kHz sinewave (8kHz + 2kHz).
In addition to this, the multiplication of the sampling signals harmonics with the sinewave
message gives pairs of sinewaves equal to the harmonics frequency plus and minus the message
frequency. That is, the signal also consists of sinewaves at the following frequencies: 14kHz
(16kHz 2kHz), 18kHz (16kHz + 2kHz), 22kHz (24kHz 2kHz), 26kHz (24kHz + 2kHz) and so
on.
All of these sum and difference sinewaves in the sampled signal are appropriately known as
aliases.
37.
Use the Signal Analyzers M1 marker to locate and measure the exact frequency of the
sampled signals first six aliases. Record your measurements in Table 1 below.
Tip: Their frequencies will be close to those listed above.
Table 1
Alias 1
Alias 4
Alias 2
Alias 5
Alias 3
Alias 6
13-15
38.
Suspend the Signal Analyzer VIs operation by pressing its RUN control once.
Note: The scopes display should freeze.
39.
40.
Locate the Tuneable Low-pass Filter module on the DATEx SFP and set its soft Gain
control to about the middle of its travel.
41.
Turn the Tuneable Low-pass Filter modules soft Cut-off Frequency Adjust control fully
anti-clockwise.
42.
MASTER
SIGNALS
TUNEABLE
LPF
DUAL ANALOG
SWITCH
S/ H
S&H
IN
100kHz
SINE
100kHz
COS
100kHz
DIGITAL
S&H
OUT
f C x100
SCOPE
CH A
IN 1
fC
CONTROL 1
CH B
CONTROL 2
8kHz
DIGITAL
TRIGGER
2kHz
DIGITAL
2kHz
SINE
GAIN
IN 2
OUT
IN
OUT
Figure 9
13-16
The set-up in Figure 9 can be represented by the block diagram in Figure 10 below. The
Tuneable Low-pass Filter module is used to recover the message. The filter is said to be
tuneable because the point at which frequencies are rejected (called the cut-off frequency)
is adjustable.
Message
To Ch.A
Tuneable
Low-pass filter
IN
2kHz
S/ H
Reconstructed
message
To Ch.B
CONTROL
8kHz
Sampling
Reconstruction
Figure 10
At this point there should be nothing out of the Tuneable Low-pass Filter module. This is
because it has been set to reject almost all frequencies, even the message. However, the cutoff frequency can be increased by turning the modules Cut-off Frequency Adjust control
clockwise.
43.
Slowly turn the Tuneable Low-pass Filter modules soft Cut-off Frequency control
clockwise and stop when the message signal has been reconstructed and is roughly in
phase with the original message.
13-17
Part E Aliasing
At present, the filter is only letting the message signal through to the output. It is
comfortably rejecting all of the other sinewaves that make up the sampled message (the
aliases). This is only possible because the frequency of these other sinewaves is high enough.
Recall from your earlier measurements that the lowest frequency alias is 6kHz.
Recall also that the frequency of the aliases is set by the sampling signals frequency (for a
given message). So, suppose the frequency of the sampling signal is lowered. A copy of the
message would still be produced because thats a function of the sampling signals DC
component. However, the frequency of the aliases would all go down. Importantly, if the
sampling signals frequency is low enough, one or more of the aliases pass through the filter
along with the message. Obviously, this would distort the reconstructed message which is a
problem known as aliasing.
To avoid aliasing, the sampling signals theoretical minimum frequency is twice the message
frequency (or twice the highest frequency in the message if it contains more than one
sinewave and is a baseband signal). This figure is known as the Nyquist Sample Rate and helps
to ensure that the frequency of the non-message sinewaves in the sampled signal is higher than
the messages frequency. That said, filters arent perfect. Their rejection of frequencies
beyond the cut-off is gradual rather than instantaneous. So in practice the sampling signals
frequency needs to be a little higher than the Nyquist Sample Rate.
The next part of the experiment lets you vary the sampling signals frequency to observe
aliasing.
44.
Slide the NI ELVIS Function Generators Control Mode switch so that its no-longer in
the Manual position.
45.
46.
47.
13-18
48.
FUNCTION
GENERATOR
DUAL ANALOG
SWITCH
MASTER
SIGNALS
TUNEABLE
LPF
S/ H
S&H
IN
ANALOG I/ O
DAC1
100kHz
COS
DAC0
SCOPE
CH A
fC
CONTROL 1
100kHz
DIGITAL
ACH0
f C x10 0
IN 1
1 0 0 kHz
SINE
ACH1
S& H
OUT
CH B
CONTROL 2
8kHz
DIGITAL
VARIABLE DC
TRIGGER
2kHz
DIGITAL
GAIN
2 kHz
SINE
IN 2
OUT
IN
OUT
Figure 11
This set-up can be represented by the block diagram in Figure 12 below. Notice that the
sampling signal is now provided by the Function Generator which has an adjustable frequency.
Message
To Ch.A
IN
2kHz
S/ H
Variable
frequency
Reconstructed
message
To Ch.B
CONTROL
Function
Generator
Sampling
Reconstruction
Figure 12
13-19
At this point, the sampling of the message and its reconstruction should be working as before.
49.
50.
Reduce the frequency of the Frequency Generators output by 1000Hz and observe the
effect this has (if any) on the reconstructed message signal.
Note: Give the Function Generator time to output the new frequency before you change
it again.
51.
Disconnect the scopes Channel B input from the Tuneable Low-pass Filter modules
output and connect it to the Dual Analog Switch modules S&H output.
52.
53.
Question 4
What has happened to the sampled signals aliases?
54.
55.
56.
Return the scopes Channel B input to the Tuneable Low-pass Filter modules output.
57.
Question 5
Whats the name of the distortion that appears when the sampling frequency is low
enough?
Question 6
What happens to the sampled signals lowest frequency alias when the sampling rate is
4kHz?
13-20
58.
59.
Increase the frequency of the Frequency Generators output in 200Hz steps and stop
the when the recovered message is a stable, clean copy of the original.
60.
Table 2
Frequency
Minimum sampling
frequency (without aliasing)
Question 7
Given the message is a 2kHz sinewave, whats the theoretical minimum frequency for the
sampling signal? Tip: If youre not sure, see the notes on page 13-18.
Question 8
Why is the actual minimum sampling frequency to obtain a reconstructed message
without aliasing distortion higher than the theoretical minimum that you calculated for
Question 5?
13-21
13-22