0% found this document useful (0 votes)
170 views18 pages

Emona Volume 1 Experiment PCM-coding

This document describes an experiment on pulse code modulation (PCM) encoding using the Emona DATEx module. The experiment involves: 1. Connecting a 0V DC voltage to the analog input of the PCM encoder module. 2. Using the function generator output as the clock signal for the PCM encoder. 3. Observing the output PCM data and clock signals on an oscilloscope to verify the encoding process. 4. Investigating the effect of quantization error by varying the input voltage levels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
170 views18 pages

Emona Volume 1 Experiment PCM-coding

This document describes an experiment on pulse code modulation (PCM) encoding using the Emona DATEx module. The experiment involves: 1. Connecting a 0V DC voltage to the analog input of the PCM encoder module. 2. Using the function generator output as the clock signal for the PCM encoder. 3. Observing the output PCM data and clock signals on an oscilloscope to verify the encoding process. 4. Investigating the effect of quantization error by varying the input voltage levels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Name:

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).

 Comparing each sample to a set of reference voltages called quantisation levels.

 Deciding which quantisation level the sampled voltage is closest to.

 Generating the binary number for that quantisation level.

 Outputting the binary number one bit at a time (that is, in serial form).

 Taking the next sample and repeating the process.

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.

14-2 © 2007 Emona Instruments Experiment 14 – PCM encoding


A little information about the PCM Encoder module on the Emona DATEx
The PCM Encoder module uses a PCM encoding and decoding chip (called a codec) to convert
analog voltages between -2V and +2V to an 8-bit binary number. With eight bits, it’s possible to
produce 256 different numbers between 00000000 and 11111111 inclusive. This in turn means
that there are 256 quantisation levels (one for each number).

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.

It should take you about 1 hour to complete this experiment.

Experiment 14 – PCM encoding © 2007 Emona Instruments 14-3


Equipment

 Personal computer with appropriate software installed

 NI ELVIS plus connecting leads


 NI Data Acquisition unit such as the USB-6251 (or a 20MHz dual channel oscilloscope)
 Emona DATEx experimental add-in module

 two BNC to 2mm banana-plug leads


 assorted 2mm banana-plug patch leads

Procedure

Part A – An introduction to PCM encoding using a static DC voltage

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. Check that the NI Data Acquisition unit is turned off.

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.

7. Turn on the PC and let it boot-up.

8. Once the boot process is complete, turn on the DAQ then look or listen for the
indication that the PC recognises it.

9. Launch the NI ELVIS software.

10. Launch the DATEx soft front-panel (SFP).

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-4 © 2007 Emona Instruments Experiment 14 – PCM encoding


12. Slide the NI ELVIS Function Generator’s Control Mode switch so that it’s no-longer in
the Manual position.

13. Launch the Function Generator’s VI.

14. Press the Function Generator VI’s ON/OFF control to turn it on.

15. Adjust the Function Generator for a 10kHz output.

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.

16. Minimise the Function Generator’s VI.

17. Locate the PCM Encoder module on the Emona DATEx SFP and set its soft Mode switch
to the PCM position.

18. Connect the set-up shown in Figure 2 below.

Note: Insert the black plugs of the oscilloscope leads into a ground (GND) socket.

SEQUENCE FUNCTION PCM


GENERATOR GENERATOR ENCODER
LINE
CODE
O

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

Experiment 14 – PCM encoding © 2007 Emona Instruments 14-5


The set-up in Figure 2 can be represented by the block diagram in Figure 3 below. The PCM
Encoder module is clocked by the Function Generator output. Its analog input is connected to
0V DC.

FS
PCM Encoder To Ch.A

OV
IN PCM data

CLK
PCM clock
10kHz To Ch.B

Function
Generator

Figure 3

19. Launch the NI ELVIS Oscilloscope VI.

20. Set up the scope per the procedure in Experiment 1 (page 1-13) with the following
changes:

 Scale control for both channels to 2V/div instead of 1V/div


 Coupling control for both channels to DC instead of AC
 Trigger Level control to 2V instead of 0V
 Timebase control to 200µs/div instead of 500µs/div

21. Set the scope’s Slope control to the “-” position.

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.

14-6 © 2007 Emona Instruments Experiment 14 – PCM encoding


22. Set the scope’s Timebase control to the
100µs/div position.

Note 1: The FS signal’s pulse should be one


division wide as shown in Figure 4. If it’s
not, adjust the Function Generator’s output
frequency until it is.

Note 2: Setting the Function Generator


this way makes each bit in the serial data
stream one division wide on the graticule’s
horizontal axis. Figure 4

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.

Ask the instructor to check


your work before continuing.

Experiment 14 – PCM encoding © 2007 Emona Instruments 14-7


25. Connect the scope’s Channel B input to the PCM Encoder module’s output as shown in
Figure 5 below.

Remember: Dotted lines show leads already in place.

SEQUENCE FUNCTION PCM


GENERATOR GENERATOR ENCODER
LINE
CODE
O

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.

14-8 © 2007 Emona Instruments Experiment 14 – PCM encoding


Question 1
Indicate on your drawing the start and end of the frame. Tip: If you’re not sure where
these points are, see the preliminary discussion.

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.

Experiment 14 – PCM encoding © 2007 Emona Instruments 14-9


Question 4
What is the binary number that the PCM Encoder module is outputting?

Question 5
Why does the PCM Encoder module output this code for 0V DC and not 0000000?

Ask the instructor to check


your work before continuing.

14-10 © 2007 Emona Instruments Experiment 14 – PCM encoding


Part B – PCM encoding of a variable DC voltage
So far, you have used the PCM Encoder module to convert a fixed DC voltage (0V) to PCM. The
next part of the experiment lets you see what happens when you vary the DC voltage.

27. Deactivate the scope’s Channel B input.

28. Slide the NI ELVIS Variable Power Supplies’ two Control Mode switches so that they’re
no-longer in the Manual position.

29. Launch the Variable Power Supplies VI.

30. Set the Variable Power Supplies two outputs to 0V by pressing the RESET buttons.

31. Unplug the patch lead connected to the ground socket.

32. Modify the set-up as shown in Figure 7 below.

FUNCTION PCM
GENERATOR ENCODER

PCM

TDM SCOPE
CH A
ANALOG I/ O

ACH1 DAC1 INPUT 2 FS


CH B

ACH0 DAC0 INPUT 1


VARIABLE DC TRIGGER
+
CLK PCM
DATA

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.

Experiment 14 – PCM encoding © 2007 Emona Instruments 14-11


Variable DC
To Ch.A
FS
To Trig.

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.

36. Determine the code on the PCM Encoder module’s output.

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.

Ask the instructor to check


your work before continuing.

14-12 © 2007 Emona Instruments Experiment 14 – PCM encoding


37. Increase the Variable Power Supplies’ negative output voltage in -0.1V increments and
note what happens to the binary number on the PCM Encoder module’s output.

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.

39. Record this voltage in Table 1 below.

Table 1
PCM Encoder’s PCM Encoder’s
output code input voltage

00000000

Ask the instructor to check


your work before continuing.

Experiment 14 – PCM encoding © 2007 Emona Instruments 14-13


40. Modify the set-up as shown in Figure 9 below.

FUNCTION PCM
GENERATOR ENCODER

PCM

TDM SCOPE
CH A
ANALOG I/ O

ACH1 DAC1 INPUT 2 FS


CH B

ACH0 DAC0 INPUT 1


VARIABLE DC TRIGGER
+
CLK PCM
DATA

Figure 9

This set-up can be represented by the block diagram in Figure 10 below.

Variable DC
To Ch.A
FS
To Trig.

IN PCM data
To Ch.B
CLK
Variable Power
Supplies 10kHz

Figure 10

14-14 © 2007 Emona Instruments Experiment 14 – PCM encoding


41. Increase the Variable Power Supplies’ positive output voltage in +0.1V increments and
note what happens to the binary number on the PCM Encoder module’s output.

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.

43. Record this voltage in Table 2 below.

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).

Ask the instructor to check


your work before continuing.

Experiment 14 – PCM encoding © 2007 Emona Instruments 14-15


Part C – PCM encoding of continuously changing voltages
Now let’s see what happens when the PCM encoder is used to convert continuously changing
signals like a sinewave.

44. Disconnect the plugs to the Variable Power Supplies positive output.

45. Modify the set-up as shown in Figure 11 below.

MASTER FUNCTION PCM


SIGNALS GENERATOR ENCODER

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

46. Set the Function Generator’s output frequency to 50kHz.

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?

14-16 © 2007 Emona Instruments Experiment 14 – PCM encoding


Ask the instructor to check
your work before finishing.

Experiment 14 – PCM encoding © 2007 Emona Instruments 14-17


14-18 © 2007 Emona Instruments Experiment 14 – PCM encoding

You might also like