Line coding and bit-clock regeneration
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.
There are quite a few line codes. Four of them are:
Non-return to zero – level (bipolar) (NRZ-L)
As you can see from Figure 1 on the next page, this code is a simple scale and level
shift of the original digital signal.
Bi-phase – level (BiΦ-L also known as Manchester code)
Figure 1 shows that this code changes state from +V to –V in the middle of the bit
period for all logic-1s and changes from –V to +V in the middle of the bit period for all
logic-0s. For consecutive bits with the same logic level, the voltage must invert after
half a bit length in order to satisfy this rule for the next bit.
Return to zero – alternate mark inversion (RZ-AMI)
Figure 1 shows that this code uses 0V to represent logic-0 and a half-bit pulse to
represent logic-1. Importantly, the polarity of the pulses alternates for every
successive logic-1 (even if they’re not consecutive bits).
Non-return to zero – mark (bipolar) (NRZ-M)
Figure 1 shows that this code changes state for each new logic-1 and doesn’t change
state for any logic-0s.
Figure 1
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
Experiment 15 – Line coding & bit clock regeneration
15-2 © Emona Instruments
For this experiment you’ll examine the four Telecoms-Trainer 101 line code equivalents
of a standard TTL data signal in the time domain and compare them to their theoretically
predicted waveshape. Next you’ll examine the signals in the frequency domain to
establish that one of them is different to the other three in terms of its spectral
composition. Finally, you’ll square the line codes to observe the effect on the component
in them at the bit-clock frequency.
Equipment
Emona Telecoms-Trainer 101 (plus power-pack)
Dual Channel 20MHz oscilloscope
Three Emona Telecoms-Trainer 101 oscilloscope leads
Assorted Emona Telecoms-Trainer 101 patch leads
Procedure
Part A – Observations of line codes in the time domain
Part A gets you observe the four Emona Telecoms-Trainer 101 line code outputs in the
time domain.
1. Gather a set of the equipment listed on the previous page.
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.
3. Connect the set-up shown in Figure 2 on the next page.
Note: Insert the black plugs of the oscilloscope leads into a ground (GND) socket.
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
Experiment 15 – Line coding & bit clock regeneration
15-3 © Emona Instruments
output is a pulse that corresponds with the same bit in the X output’s sequence on every
repetition and is used to trigger the scope.
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
4. Set up the scope per the instructions in the Appendix.
5. Adjust the following scope controls as indicated:
Vertical Attenuation control for both channels to the 2V/div position
Input Coupling controls for both channels to the DC position
Timebase control to the 1ms/div position
Trigger Source control to the EXT position
Note: You’ll now be viewing a portion of the X output’s 31-bit sequence.
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.
Note: Leave room for three more signals.
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.
Experiment 15 – Line coding & bit clock regeneration
15-4 © Emona Instruments
12. Repeat Steps 8 to 11 for the NRZ-L signal on the scope’s Channel 2 input.
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-
Experiment 15 – Line coding & bit clock regeneration
15-5 © Emona Instruments
switches to 11 and draw the signal time-coincident with the others.
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.
Part B – Observations of line codes in the frequency domain
Part B gets you examine the four Emona Telecoms-Trainer 101 line code outputs in the
frequency domain using a spectrum analyser.
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.
Experiment 15 – Line coding & bit clock regeneration
15-6 © Emona Instruments
M A S TER S EQ U EN C E
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 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.
Experiment 15 – Line coding & bit clock regeneration
15-7 © Emona Instruments
Figure 5
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.
25. Change the filename to NRZ-L and click on Save.
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.
Experiment 15 – Line coding & bit clock regeneration
15-8 © Emona Instruments
28. Close the four “snapshots” and return to the “live” PicoScope window.
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.
33. Set the spectrum analyser’s Spectrum Range to 24.41kHz.
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
Experiment 15 – Line coding & bit clock regeneration
15-9 © Emona Instruments
BiΦ-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?
Experiment 15 – Line coding & bit clock regeneration
15-10 © Emona Instruments