© 2007 Emona Instruments Experiment 15 - PCM Decoding 15-2
© 2007 Emona Instruments Experiment 15 - PCM Decoding 15-2
© 2007 Emona Instruments Experiment 15 - PCM Decoding 15-2
Preliminary discussion
The previous experiment introduced you to the basics of pulse code modulation (PCM) which
you’ll recall is a system for converting message signals to a continuous serial stream of binary
numbers (encoding). Recovering the message from the serial stream of binary numbers is called
decoding.
Holding the voltage on the output until the next frame has been decoded (forming a pulse
amplitude modulation (PAM) version of the original message signal).
Reconstructing the message by passing the PAM signal through a low-pass filter.
The PCM decoder’s clock frequency is crucial to the correct operation of simple decoding
systems. If it’s not the same frequency as the encoder’s clock, some of the transmitted bits
are read twice while others are completely missed. This results in some of the transmitted
numbers being incorrectly interpreted, which in turn causes the PCM decoder to output an
incorrect voltage. The error is audible if it occurs often enough. Some decoders manage this
issue by being able to “self-clock”.
There is another issue crucial to PCM decoding. The decoder must be able to detect the
beginning of each frame. If this isn’t done correctly, every number is incorrectly interpreted.
The synchronising of the frames can be managed in one of two ways. The PCM encoder can
generate a special frame synchronisation signal that can be used by the decoder though this
has the disadvantage of needing an additional signal to be sent. Alternatively, a frame
synchronisation code can be embedded in the serial data stream that is used by the decoder
to work out when the frame starts.
The PCM Decoder module is not self-clocking and so it needs a digital signal on the CLK input to
operate. Importantly, for the PCM Decoder module to correctly decode PCM data generated
by the PCM Encoder module, it must have the same clock signal. In other words, the decoder’s
clock must be “stolen” from the encoder.
Similarly, the PCM Decoder module cannot self-detect the beginning of each new frame and so
it must have a frame synchronisation signal on its FS input to do this.
The experiment
In this experiment you’ll use the Emona DATEx to convert a sinewave and speech to a PCM
data stream then convert it to a PAM signal using the PCM Decoder module. For this to work
correctly, the decoder’s clock and frame synchronisation signal are simply “stolen” the PCM
Encoder module. You’ll then recover the message using the Tuneable Low-pass filter module.
Equipment
NI Data Acquisition unit such as the USB-6251 (or a 20MHz dual channel oscilloscope)
Emona DATEx experimental add-in module
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.
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
Power switch at the front.
8. Once the boot process is complete, turn on the DAQ then look or listen for the
indication that the PC recognises it.
10. Launch the DATEx soft front-panel (SFP) and check that you have soft control over the
DATEx board.
11. Slide the NI ELVIS Variable Power Supplies’ positive output Control Mode switch so that
it’s no-longer in the Manual position.
13. Set the Variable Power Supplies’ positive output to 0V by pressing its RESET button.
14. Locate the PCM Encoder module on the DATEx SFP and set its soft Mode switch to the
PCM position.
Note: Insert the black plugs of the oscilloscope leads into a ground (GND) socket.
PCM
TDM SCOPE
ANALOG I/ O CH A
1 0 0 kHz
SINE
1 0 0 kHz ACH1 DAC1 INPUT 2 FS
COS CH B
1 0 0 kHz
DIGITAL
8 kHz ACH0 DAC0 INPUT 1
DIGITAL VARIABLE DC TRIGGER
2 kHz
DIGITAL +
2 kHz CLK PCM
SINE DATA
Figure 1
This set-up can be represented by the block diagram in Figure 2 below. The PCM Encoder
module is clocked by the Master Signals module’s 100kHz DIGITAL output. Its analog input is
the Variable Power Supplies’ positive output.
FS
To Ch.A
IN PCM data
To Ch.B
CLK
Variable Power
Supplies 100kHz
Master
Signals
Figure 2
17. Set up the scope per the procedure in Experiment 1 (page 1-13) with the following
changes:
19. Activate the scope’s Channel B input by pressing the Channel B Display control’s ON/OFF
button to observe the PCM Encoder module’s PCM DATA output as well as its FS output.
20. Vary the Variable Power Supplies positive output Voltage control left and right (but
don’t exceed 2.5V).
If your set-up is working correctly, this last step should cause the number on PCM Encoder
module’s PCM DATA output to go down and up. If it does, carry on to the next step. If not,
check your wiring or ask the instructor for help.
22. Slide the NI ELVIS Function Generator’s Control Mode switch so that it’s no-longer in
the Manual position.
24. Press the Function Generator VI’s ON/OFF control to turn it on.
25. Adjust the Function Generator using its soft controls for an output with the following
specifications:
Waveshape: Sine
Frequency: 500Hz
Amplitude: 4Vp-p
DC Offset: 0V
27. Disconnect the plug to the Variable Power Supplies’ positive output.
PCM
TDM SCOPE
ANALOG I/ O CH A
100kHz
SINE
100kHz ACH1 DAC1 INPUT 2 FS
COS CH B
100kHz
DIGITAL
8kHz ACH0 DAC0 INPUT 1
DIGITAL
VARIABLE DC TRIGGER
2kHz
DIGITAL +
2kHz CLK PCM
SINE DATA
Figure 3
This set-up can be represented by the block diagram in Figure 4 below. Notice that the PCM
Encoder module’s input is now the Function Generator’s output.
Function FS
Generator To Ch.A
100kHz
Figure 4
As the PCM Encoder module’s input is a sinewave, the module’s input voltage is continuously
changing. This means that you should notice the PCM DATA output changing continuously also.
GND
PCM
TDM
TDM SCOPE
ANALOG I/ O CH A
1 0 0kHz
SINE
1 0 0kHz ACH1 DAC1 INPUT 2 FS FS
COS CH B
1 0 0kHz
DIGITAL
8 kHz ACH0 DAC0 INPUT 1 PCM OUTPUT2
DIGITAL DATA
VARIABLE DC TRIGGER
2 kHz
DIGITAL +
2 kHz CLK PCM CLK OUTPUT
SINE DATA
Figure 5
The entire set-up can be represented by the block diagram in Figure 6 on the next page.
Notice that the decoder’s clock and frame synchronisation information are “stolen” from the
encoder.
100kHz
Figure 6
33. Activate the scope’s Channel B input to observe the PCM Decoder module’s output as well
as the message signal.
Question 1
What does the PCM Decoder’s “stepped” output tell you about the type of signal that it
is? Tip: If you’re not sure, see the preliminary discussion for this experiment or for
Experiment 13.
General
Sampling to Run
Input Settings
Triggering
Frequency Display
37. Activate the Signal Analyzer’s markers by pressing the Markers button.
38. Use the Signal Analyzer’s M1 marker to examine the frequency of the sinewaves that
make up the sampled message.
39. Use the M1 marker to locate the sinewave in the sampled message that has the same the
frequency as the original message.
You have probably just noticed that many of the extra sinewaves in the sampled message are
at audible frequencies (that is, between about 20Hz and 20kHz). This means that, although
the message and sampled messages are similar in shape, you should be able to hear a
difference between them.
40. Add the Amplifier module to the set-up as shown in Figure 7 below leaving the scope’s
connections as they are.
GND 0dB
PCM -6dB
TDM
TDM -20dB
ANALOG I/ O
100kHz
SINE AMPLIFIER
100kHz ACH1 DAC1 INPUT 2 FS FS
COS
100kHz
DIGITAL
8kHz ACH0 DAC0 INPUT 1 PCM OUTPUT2 GAIN
DIGITAL DATA
VARIABLE DC
2kHz
DIGITAL +
2kHz CLK PCM CLK OUTPUT IN OUT
SINE DATA
Figure 7
41. Locate the Amplifier module on the DATEx SFP and turn its soft Gain control fully anti-
clockwise.
42. Without wearing the headphones, plug them into the Amplifier module’s headphone
socket.
44. Turn the Amplifier module’s soft Gain control clockwise until you can comfortably hear
the PCM Decoder module’s output.
45. Listen to how the sampled message sounds and commit it to memory.
47. Modify the set-up as shown in Figure 8 below, again leaving the scope’s connections as
they are.
GND 0 dB
PCM -6 dB
TDM
TDM -2 0dB
ANALOG I/ O
1 0 0 kHz
SINE AMPLIFIER
1 0 0 kHz ACH1 DAC1 INPUT 2 FS FS
COS
1 0 0 kHz
DIGITAL
8 kHz ACH0 DAC0 INPUT 1 PCM OUTPUT2 GAIN
DIGITAL DATA
VARIABLE DC
2 kHz
DIGITAL +
2 kHz CLK PCM CLK OUTPUT IN OUT
SINE DATA
Figure 8
48. Compare the sound of the two signals. You should notice that they’re similar but clearly
different.
Question 2
What must be done to the PCM Decoder module’s output to reconstruct the message
properly?
49. Close the Signal Analyzer VI and launch the NI ELVIS Oscilloscope VI.
50. Adjust the scope so that you can observe two or so cycles of the original and sampled
messages again.
Tip: Don’t forget to set the scope’s Trigger Source control to the CH A position.
51. Completely remove the Amplifier module from the set-up while leaving the rest of the
leads in place.
1 0 0 kHz INPUT 2 FS FS
COS Y
CH B
1 0 0 kHz CLK
DIGITAL
SPEECH
8 kHz INPUT 1 PCM OUTPUT2
DIGITAL DATA
TRIGGER
2 kHz
DIGITAL
GND
2 kHz CLK PCM CLK OUTPUT
SINE DATA
GND
Figure 9
55. Hum and talk into the microphone while watching the scope’s display.
56. Locate the Tuneable Low-pass Filter module on the DATEx SFP and set its soft Gain
control to about the middle of its travel.
57. Turn the Tuneable Low-pass Filter module’s soft Cut-off Frequency Adjust control fully
anti-clockwise.
GND
PCM f C x10 0
TDM
TDM SCOPE
ANALOG I/ O CH A
100kHz
SINE
100kHz ACH1 DAC1 INPUT 2 FS FS
COS fC CH B
100kHz
DIGITAL
8kHz ACH0 DAC0 INPUT 1 PCM OUTPUT2
DIGITAL DATA
VARIABLE DC TRIGGER
2kHz
DIGITAL + GAIN
2kHz CLK PCM CLK OUTPUT
SINE DATA
IN OUT
Figure 10
The entire set-up can be represented by the block diagram in Figure 11 on the next page. The
Tuneable Low-pass Filter module is used to reconstruct the original message from the PCM
Decoder module’s PAM output.
Message
500Hz IN To Ch.B
PCM
CLK DATA CLK
100kHz
Figure 11
60. Slowly turn the Tuneable Low-pass Filter module’s soft Cut-off Frequency control
clockwise and stop the moment the message signal has been reconstructed (ignoring
phase shift).
The two signals are clearly the same so let’s see what your hearing tells you.
61. Add the Amplifier module to the set-up as shown in Figure 12 below leaving the scope’s
connections as they are.
GND 0 dB
Figure 12
64. Turn the Amplifier module’s soft Gain control clockwise until you can comfortably hear
the Tuneable Low-pass Filter module’s output.
66. Disconnect the Amplifier module’s lead where it plugs to the PCM Decoder module’s
output and connect it to the Function Generator’s output (in the same way that you did
when wiring the set-up in Figure 8).
67. Compare the sound of the two signals. You should find that they’re very similar.
Question 3
Even though the two signals look and sound the same, why isn’t the reconstructed
message a perfect copy of the original message? Tip: If you’re not sure, see the
preliminary discussion for Experiment 14.