Emona Volume 1 Experiment PCM-coding
Emona Volume 1 Experiment PCM-coding
Class:
14 - PCM encoding
Experiment 14 – PCM encoding
Preliminary discussion
As you know, digital transmission systems are steadily replacing analog systems in commercial
communications applications. This is especially true in telecommunications. That being the case,
an understanding of digital transmission systems is crucial for technical people in the
communications and telecommunications industries. The remaining experiments in this book use
the Emona DATEx to introduce you to several of these systems starting with pulse code
modulation (PCM).
PCM is a system for converting analog message signals to a serial stream of 0s and 1s. The
conversion process is called encoding. At its simplest, encoding involves:
Sampling the analog signal’s voltage at regular intervals using a sample-and-hold scheme
(demonstrated in Experiment 13).
Outputting the binary number one bit at a time (that is, in serial form).
An issue that is crucial to the performance of the PCM system is the encoder’s clock
frequency. The clock tells the PCM encoder when to sample and, as the previous experiment
shows, this must be at least twice the message frequency to avoid aliasing (or, if the message
contains more than one sinewave, at least twice its highest frequency).
Another important PCM performance issue relates to the difference between the sample
voltage and the quantisation levels that it is compared to. To explain, most sampled voltages
will not be the same as any of the quantisation levels. As mentioned above, the PCM Encoder
assigns to the sample the quantisation level that is closest to it. However, in the process, the
original sample’s value is lost and the difference is known as quantisation error. Importantly,
the error is reproduced when the PCM data is decoded by the receiver because there is no way
for the receiver to know what the original sample voltage was. The size of the error is
affected by the number of quantisation levels. The more quantisation levels there are (for a
given range of sample voltages) the closer they are together. This means that the difference
between the quantisation levels and the samples is smaller and so the error is lower.
Each binary number is transmitted in serial form in frames. The number’s most significant bit
(called bit-7) is sent first, bit-6 is sent next and so on to the least significant bit (bit-0). The
PCM Encoder module also outputs a separate Frame Synchronisation signal (FS) that goes high
at the same time that bit-0 is outputted. The FS signal has been included to help with PCM
decoding (discussed in the preliminary discussion of Experiment 15) but it can also be used to
help “trigger” a scope when looking at the signals that the PCM Encoder module generates.
Figure 1 below shows an example of three frames of a PCM Encoder module’s output data (each
bit is shown as both a 0 and a 1 because it could be either) together with its clock input and its
FS output.
Figure 1
The experiment
In this experiment you’ll use the PCM Encoder module on the Emona DATEx to convert the
following to PCM: a fixed DC voltage, a variable DC voltage and a continuously changing signal.
In the process, you’ll verify the operation of PCM encoding and investigate quantisation error a
little.
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.
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.
11. Check you now have soft control over the DATEx by activating the PCM Encoder
module’s soft PDM/TDM control on the DATEx SFP.
Note: If you’re set-up is working correctly, the PCM Decoder module’s LED on the
DATEx board should turn on and off.
14. Press the Function Generator VI’s ON/OFF control to turn it on.
Note: It’s not necessary to adjust any other controls as the Function Generator’s SYNC
output will be used and this is a digital signal.
17. Locate the PCM Encoder module on the Emona 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.
1
PCM
OO NRZ-L
SYNC
O1 Bi-O
1 O RZ-AMI TDM SCOPE
1 1 NRZ-M ANALOG I/ O CH A
X
ACH1 DAC1 INPUT 2 FS
Y
CH B
CLK
SPEECH
ACH0 DAC0 INPUT 1
VARIABLE DC TRIGGER
+
GND
CLK PCM
DATA
GND
Figure 2
FS
PCM Encoder To Ch.A
OV
IN PCM data
CLK
PCM clock
10kHz To Ch.B
Function
Generator
Figure 3
20. Set up the scope per the procedure in Experiment 1 (page 1-13) with the following
changes:
Setting the Slope control to the “-“ position makes the scope start its sweep across the screen
when the FS signal goes from high to low instead of low to high. You can really notice the
difference between the two settings if you flip the scope’s Slope control back and forth. If
you do this, make sure that the Slope control finishes on the “-” position.
23. 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 CLK input as well as its FS output.
Tip: To see the two waveforms clearly, you may need to adjust the scope so that the
two signals are not overlayed.
24. Draw the two waveforms to scale in the space provided on page 14-9 leaving enough room
for a third digital signal.
Tip: Draw the clock signal in the upper third of the graph paper and the FS signal in the
middle third.
1
PCM
OO NRZ-L
SYNC
O1 Bi-O
1 O RZ-AM I TDM SCOPE
1 1 NRZ-M ANALOG I/ O CH A
X
ACH1 DAC1 INPUT 2 FS
Y
CH B
CLK
SPEECH
ACH0 DAC0 INPUT 1
VARIABLE DC TRIGGER
+
GND
CLK PCM
DATA
GND
Figure 5
This set-up can be represented by the block diagram in Figure 6 below. Channel B should now
display 10 bits of the PCM Encoder module’s data output. Reading from the left of the display,
the first 8 bits belong to one frame and the last two bits belong to the next frame.
FS
To Ch.A
OV
IN PCM data
To Ch.B
CLK
10kHz
Figure 6
26. Draw this waveform to scale in the space that you left on the graph paper.
Question 2
Indicate on your drawing the start and end of each bit.
Question 3
Indicate on your drawing which bit is bit-0 and which is bit-7.
Question 5
Why does the PCM Encoder module output this code for 0V DC and not 0000000?
28. Slide the NI ELVIS Variable Power Supplies’ two Control Mode switches so that they’re
no-longer in the Manual position.
30. Set the Variable Power Supplies two outputs to 0V by pressing the RESET buttons.
FUNCTION PCM
GENERATOR ENCODER
PCM
TDM SCOPE
CH A
ANALOG I/ O
Figure 7
This set-up can be represented by the block diagram in Figure 8 on the next page. The NI
ELVIS Variable Power Supplies is used to let you vary the DC voltage on the PCM Encoder
module’s input. The scope’s external trigger input is used to obtain a stable display.
IN PCM data
To Ch.B
CLK
Variable Power
Supplies 10kHz
Figure 8
33. Set the scope’s Trigger Source control to the TRIGGER position.
34. Set the scope’s Channel A Scale control to the 500mV/div position.
35. Activate the scope’s Channel B input to observe the PCM Encoder module’s data output
as well as its DC input voltage.
Tip: Remember, the first eight horizontal divisions of the scope’s graticule correspond
with one frame of the PCM Encoder module’s output.
Note: You should find that the PCM Encoder module’s output is a binary number that is
reasonably close to the code you determined earlier when the module’s input was
connected directly to ground.
Tip: This is easiest to do by simply typing the required voltage in the field under the
negative output’s Voltage control. When you do, don’t forget to put a minus sign in front
of the voltage you enter.
Question 6
What happens to the binary number as the input voltage increases in the negative
direction?
38. Determine the lowest negative voltage that produces the number 00000000 on the PCM
Encoder module’s output.
Table 1
PCM Encoder’s PCM Encoder’s
output code input voltage
00000000
FUNCTION PCM
GENERATOR ENCODER
PCM
TDM SCOPE
CH A
ANALOG I/ O
Figure 9
Variable DC
To Ch.A
FS
To Trig.
IN PCM data
To Ch.B
CLK
Variable Power
Supplies 10kHz
Figure 10
Question 7
What happens to the binary number as the input voltage increases in the positive
direction?
42. Determine the lowest positive voltage that produces the number 11111111 on the PCM
Encoder module’s output.
Table 2
PCM Encoder’s PCM Encoder’s
output code input voltage
11111111
Question 8
Based on the information in Tables 1 & 2, what is the maximum allowable peak-to-peak
voltage for an AC signal on the PCM Encoder module’s INPUT?
Question 9
Calculate the difference between the PCM Encoder module’s quantisation levels by
subtracting the values in Tables 1 & 2 and dividing the number by 256 (the number of
codes).
44. Disconnect the plugs to the Variable Power Supplies positive output.
PCM
TDM SCOPE
ANALOG I/ O CH A
1 0 0kHz
SINE
1 0 0kHz ACH1 DAC1 INPUT 2 FS
COS CH B
1 0 0kHz
DIGITAL
8 kHz ACH0 DAC0 INPUT 1
DIGITAL VARIABLE DC TRIGGER
2 kHz
DIGITAL +
2 kHz CLK PCM
SINE DATA
Figure 11
47. Set the scope’s Timebase control to the 100µs/div position and its Channel A Scale
control to the 2V/div position.
48. Watch the PCM Encoder module’s output on the scope’s display.
Note: The sinewave will move about the screen a little because the scope is triggered on
the PCM Encoder module’s FS output.
Question 10
Why does the code on PCM Encoder module’s output change continuously?