Line Coding
Line Coding
Preliminary discussion
Line coding
As you know, logic-0 and logic-1 in digital systems are represented by assigned voltages.
For example, the TTL logic-0 is represented by 0V and the TTL logic-1 is represented by
5V (or by acceptable voltages relatively close to 0V and 5V). As you also know, the logic
levels for other logic families like CMOS, ECL, etc are not necessarily 0V and 5V. This tells
us that logic levels can be represented by any pair of voltages we like. That said, the
choice of which voltages to use is not as arbitrary as that may seem. It’s usually an
engineering decision made to confer an advantage.
Importantly, this is also true for the choice of voltages used when sending digital signals
over transmission lines like telephone lines. Standard TTL and CMOS voltages are less
than ideal for this purpose. Moreover, even the basic premise of holding the voltage at a
particular value for the entire duration of the logic state’s value can be disadvantageous.
For these reasons, digital signals within systems are often conditioned for transmission
line communications and this is called line coding.
0 1 0 0 0 0 1 1 1 0 0 1 0
5V
TTL
0V
NRZ-L 0V
Bio -L 0V
RZ-AM I 0V
NRZ-M 0V
Table 1 below compares the minimum bandwidth requirements for propagating these
signals along transmission lines. It also shows the line code’s usefulness for bit-clock
regeneration.
Table 1
Line code Minimum Bit-clock
bandwidth regeneratio
n
fb
NRZ-L Poor
2
BiΦ-L fb Very good
fb
RZ-AMI Good
2
fb
NRZ-M Poor
2
As you can see, RZ-AMI offers the best compromise of the four between bandwidth and
bit-clock regeneration (as well as other line code characteristics not mentioned here) and
so it is widely used.
The experiment
Equipment
Procedure
2. Locate the Sequence Generator module and set its DIP-switches to 00.
Note: This selects NRZ-L as the line code for the Sequence Generator module’s
LINE CODE output.
M A S TER S EQU EN CE
S IGN A L S GEN ER ATOR
L IN E
CODE
O
O O N R Z -L
O 1 B i-O SYN C
1 O R Z -A M I
1 1 N R Z -M
1 0 0 kH z X
S IN E
1 0 0 kH z
Y
C OS
1 0 0 kH z CLK
D IGITA L
D IVID ER
8 kH z
D IGITA L
2 kH z
D IGITA L
2 kH z
S IN E
IN OUT
Figure 2
This set-up can be represented by the block diagram in Figure 3 below. The Master
Signals module’s 2kHz DIGITAL output is used to provide the Sequence Generator
module’s bit-clock. The Sequence Generator module’s X output is a continuous 31-bit
sequential binary number. The Sequence Generator module’s LINE CODE output is a copy
of its X output using the line code scheme set by the DIP-switches. The module’s SYNC
X sequence
T o CH 1
X
CL K L I N E CO D E
L ine code
2 kH z T o CH 2
Clock SYN C
M ast er
S ignals SYN C
T o EX T
S equence
Gener at or
Figure 3
6. Set the scope’s Mode control to the DUAL position to view both the Sequence
Generator module’s X and LINE CODE outputs.
Note 1: You may need to adjust the scope’s Trigger Level control to obtain a
stable display.
Note 2: Once done, you’ll be observing the model of a standard TTL digital data
signal and its NRZ-L equivalent.
7. Draw the two waveforms to scale and time-coincident with each other in the
space provided on the next page.
8. Set the scope’s Channel 1 Input Coupling control to the Ground (GND) position.
9. Align the scope’s Channel 1 trace with one of the horizontal lines on the graticule.
10 Return the scope’s Channel 1 Input Coupling control to the DC position.
.
11 Measure the absolute voltage of the X output’s two states and indicate these on
. your drawing.
12. Select the BiΦ-L line code by setting the Sequence Generator module’s DIP-
switches to 01.
13 Draw the line code signal time-coincident with the other two.
.
14 Measure and record the absolute voltage of the signal’s two states.
.
15. Select the RZ-AMI line code by setting the Sequence Generator module’s DIP-
switches to 10 and draw the signal time-coincident with the others.
16 Measure and record the absolute voltage of the signal’s three states.
.
17. Select the NRZ-M line code by setting the Sequence Generator module’s DIP-
18 Measure and record the absolute voltage of the signal’s two states.
.
19. Compare each of the line code signals with the rules underpinning them
summarised in the preliminary discussion.
Note: If any the signals appear to change when they shouldn’t or don’t change
when they should, check your drawing. If your drawing is correct, call the instructor
for assistance.
Question 1
Which of the four line codes is bipolar?
Question 2
Which of the four line codes represents the logic-0 in the data using 0V?
Question 3
Use the rule for RZ-AMI to determine the number of logic-1s in the portion of the X
output’s data sequence being displayed.
20. Select the NRZ-L line code by returning the Sequence Generator module’s DIP-
switches to 00.
21. Modify the set-up to include the spectrum analyser as shown in Figure 4 below.
Note: The following instructions relate to a PC-based spectrum analyser called the
PicoScope 3204. Other spectrum analysis devices can be used provided the
bandwidth is at least 250kHz.
O O N R Z -L
O 1 B i-O SYN C
1 O R Z -A M I
1 1 N R Z -M
1 0 0 kH z X
S IN E
1 0 0 kH z Y
C OS
1 0 0 kH z CLK
D IGITA L
D IVID ER
8 kH z
D IGITA L
2 kH z
D IGITA L
2 kH z
S IN E
IN OU T
PC -b a se d
Sp e c trum
Ana lyse r
CH A
CH B
Figure 4
22 Launch the PicoScope software and set its spectrum analyser controls as follows:
.
General
Spectrum Range to 48.83kHz
Horizontal Zoom to ×1
Channel A Input Range to Auto
Channel B Input Range to Off
Spectrum Options
Spectrum Bins to 16384
Window Function to Blackman-Harris
Display Mode to Magnitude
Scale to Logarithmic
Logarithmic Unit to dBV
Note 1: If you’re using a spectrum analyser other than the PicoScope 3204, see
your instructor for a list of the controls to adjust and their appropriate settings.
Note 2: If the spectrum analyser has been set up correctly, its display will be
similar to Figure 5 below.
The pattern of humps (or lobes) and nulls in the NRZ-L line code’s spectrum is typical of
digital data signals (for reasons explained in Experiment 14). Let’s compare it to the
spectral pattern of the other three line codes.
23. Click File on the PicoScope software’s menu toolbar and select Save Current
Waveform As...
24. Select Desktop in the Save In line of the window that appears.
Note: This will save the file on the desktop making it easier to find later.
26 Select each of the remaining three line codes one at a time and repeat Steps 24
. to 26 using an appropriate filename for the line codes.
27. To compare the four line codes, locate the files that you saved on the desktop
and open them all.
Note: You’ll need to resize and reposition the windows to compare the spectra
side-by-side.
Although all four codes exhibit the pattern mentioned above, you should be able to see
that their spectral composition is different. Recall that this is one of the reasons for
choosing to use one code over another.
One of the disadvantages of BiΦ-L (Manchester code) is that it requires twice the
bandwidth of the other three codes to propagate the signal along a transmission line.
While this limitation cannot be demonstrated using the Telecoms-Trainer 101 directly, we
can examine the spectrum of the four signals more closely to see that BiΦ-L is spectrally
different to the other three line codes.
29. Set the Sequence Generator module’s output to the NRZ-L line code.
30. Count the number of lobes in the NRZ-L line code’s spectrum. Record your count in
Table 2 below.
Note: This figure is not the total number of lobes in the signals’ spectrum –
Remember that the spectrum analyser’s Frequency Range is set to 48.83kHz.
31. Repeat Steps 30 and 31 for the other three line codes.
Table 2
Lobes
Line code
(in 40kHz span)
NRZ-L
BiΦ-L
RZ-AMI
NRZ-M
To compare BiΦ-L to the other codes in another way, you’ll use one of the spectrum
analyser’s rulers to examine the null frequencies.
32. Set the Sequence Generator module’s output to the NRZ-L line code.
34. Move the mouse to the junction of the display’s X and Y axes.
Note: When you do, the mouse cursor will change shape and a label will pop up
declaring
“1: Inactive”.
35 Click and hold the left mouse button and then move it left and right.
.
Note 1: When you do this, a dashed line representing frequency ruler #1
appears.
Note 2: A ruler legend also appears indicating the absolute frequency at the
ruler.
36 Align the ruler with the NRZ-L line code’s first null (that is, the deep trough
. between the first and second lobes at the left end of the signal’s spectrum).
37. Measure the null’s frequency and record this in Table 3 below.
38. Repeat Steps 37 and 38 for the other three line codes.
Table 3
Frequency of
Line code
first null
NRZ-L
RZ-AMI
NRZ-M
Question 4
Based on your results in Tables 2 and 3, which of the four codes is the odd one out?