Chapter 4 - Data Encoding
Chapter 4 - Data Encoding
DATA/SIGNAL ENCODING
TECHNIQUES
1
Data Communication Basics
In communication systems we have Analog or
Digital data and Analog or Digital signals.
Three Components of a communication systems
are;
• The Data you want to transmit (analog or digital).
• The Signal which is going to transmit the data
(analog or digital).
• The Transmission.
2
Analog Data Choices
3
Digital Data Choices
4
Encoding Techniques
1. Digital data, Digital signal.
2. Digital data, Analog signal.
3. Analog data, Digital signal.
4. Analog data, Analog signal.
5
Transmission Choices
Analog transmission.
• We can only transmit analog signals, without regard
for data content.
• Attenuation which is a major problem is overcome
with amplifiers.
Digital transmission.
• Transmits analog or digital signals.
• We use repeaters rather than amplifiers to boost the
signal strength.
6
Advantages of Digital Transmission
1. The signal is exact thus limiting inter-symbol
interference because it is easy to decode at the
receiver.
2. Signals can be checked for errors.
3. Noise/interference are easily filtered out.
4. A variety of services can be offered over one
line.
5. Higher bandwidth is possible with data
compression.
7
Encoding schemes
8
Encoding and Modulation
x(t)
g(t) x(t) g(t
)
Encoder Decoder
digital digita
or l
analo
g t
s(f)
m(t) s(t)
m(t)
Modulator Demodulator
digital analo
or g f
analog fc
f
c
9
Why encoding?
10
Encoding Schemes' evaluation factors
1. Signal spectrum.
2. Clocking.
3. Error detection.
11
Terms:
Uni-polar
All signal elements have same sign. All the signal levels are on one
side of the time axis (either above or below) e. g NRZ
Polar
The voltages are on both sides of the time axis e.g. the voltage
level for 0 can be positive and for 1 negative. E.g NRZ (NRZ-I
and NRZ-L)
Bi-Polar
Here we have three voltage levels, positive, negative and zero
Data rate
Rate of data transmission in bits per second.
Duration or length of a bit.
Time taken for transmitter to emit the bit.
12
Terms:
Modulation rate
• Rate at which the signal level changes.
• Measured in baud = signal elements per second.
Mark and Space
Binary 1 and Binary 0 respectively.
Line coding
This is the process of converting digital data to digital signals.
Data in the form of text, numbers, graphical images audio, video are
stored in computer memory as sequence of bits. Line coding
converts a sequence of bits into a digital signal
13
Terms: Signal Element Versus Data Element Let
us distinguish between a data element and a
signal element
In data communications, our goal is to send data
elements.
A data element is the smallest entity that can represent
a piece of information: this is the bit. In digital data
communications, a signal element carries data
elements.
A signal element is the shortest unit (time wise) of a
digital signal. In other words, data elements are what
we need to send; signal elements are what we can
send. Data elements are being carried; signal
elements are the carriers.
14
Terms: Signal Element Versus Data Element
15
Signal Element Versus Data Element
16
Example 4.1
Solution
We assume that the average value of c is 1/2 . The baud
rate is then
4.17
For the receiver to interprete Signals
It Need to know:
• Timing of bits - when they start and end
• Signal levels
Factors affecting successful interpretation of
signals at the receiver:
• Signal to noise ratio
• Data rate
• Bandwidth
18
Terms: Data Rate Versus Signal Rate
The data rate defines the number of data elements
19
Terms:
Baseline Wandering :In decoding a digital signal, the
receiver calculates a running average of the received
signal power. This average is called the baseline. The
incoming signal power is evaluated against this baseline to
determine the value of the data element. A long string of
0s or 1 s can cause a drift in the baseline (baseline
wandering) and make it difficult for the receiver to decode
correctly. A good line coding scheme needs to prevent
baseline wandering.
20
Terms
DC Components: When the voltage level in a digital
signal is constant for a while, the spectrum creates very
low frequencies (results of Fourier analysis). These
frequencies around zero, called DC (direct-current)
components, present problems for a system that cannot
pass low frequencies or a system that uses electrical
coupling (via a transformer).
21
Terms
Self-synchronization :To correctly interpret the signals
received from the sender, the receiver's bit intervals must
correspond exactly to the sender's bit intervals. If the
receiver clock is faster or slower, the bit intervals are not
matched and the receiver might misinterpret the signals.
Figure 4.3 shows a situation in which the receiver has a
shorter bit duration. The sender sends 101 10001, while
the receiver receives 1 101 1 100001 1.
22
Figure 4.3 Effect of lack of synchronization
4.23
Terms
Built-in Error Detection It is desirable to have a built-in
error-detecting capability in the generated code to detect
some of or all the errors that occurred during transmission.
Some encoding schemes that we will discuss have this
capability to some extent.
Immunity to Noise and Interference Another desirable
code characteristic is a code , that is immune to noise and
other interferences. Some encoding schemes that we will
discuss have this capability.
Complexity A complex scheme is more costly to implement
than a simple one. For example, a scheme that uses four
signal levels is more difficult to interpret than one that uses
only two levels.
24
Comparison of Encoding Schemes [1/2]
1- Signal Spectrum.
• Lack of high frequencies reduces required bandwidth.
• Lack of dc component allows ac coupling via
transformer, providing isolation.
• It is important to concentrate power in the middle of
the bandwidth.
2- Clocking issues.
• Synchronizing transmitter and receiver is essential.
• External clock is one way used for synchronization.
• Synchronizing mechanism based on signal is also used
& preferred (over using an external clock).
25
Comparison of Encoding Schemes [2/2]
3- Error detection.
• Can be built into signal encoding.
• Signal interference and noise immunity.
• Some codes are better than others.
4- Cost and complexity.
• Higher signal rate (& thus data rate) lead to higher
costs.
• Some codes require signal rate greater than data rate.
26
1- DIGITAL DATA, DIGITAL SIGNAL
Characteristics:
Digital signal.
• Uses discrete, discontinuous, voltage pulses.
• Each pulse is a signal element.
• Binary data is encoded into signal elements.
27
ENCODING SCHEMES (for digital
data/signals)
Unipolar
1. Non-return to Zero
• Level (NRZ-L)
• Inverted (NRZI)
2. Bipolar -AMI (Alternate Mark Inversion)
3. Pseudoternary
Biphase/Polar.
4. Manchester
5. Differential Manchester
6. B8ZS
7. HDB3
28
Line coding schemes
29
Digital data, Digital signal
0 1 0 0 1 1 0 0 0 1 1
NRZ
NRZI
Bipolar -AMI
Pseudoternary
Manchester
Differential
Manchester
30
Figure 4.5 Unipolar NRZ scheme
4.31
Non-return to Zero-Level (NRZ-L)
Two different voltages for 0 and 1 bits.
the level of the voltage determines the value of the bit
Has a problem of baseline wondering for a long sequence of
zero’s or one’s
The synchronization problem: (sender and receiver clocks are
not synchronized
32
Non-return to Zero Inverted – (NRZ-I)
Non-return to zero inverted on ones.
Constant voltage pulse for duration of bit.
Data encoded as presence or absence of signal
transition at beginning of bit time.
Transition (low to high or high to low) denotes a
binary 1.
No transition denotes binary 0.
An example of differential encoding.
(Data represented by changes rather than levels)
33
NRZ
34
Note
4.35
NRZ Pros and Cons (both NRZ-I and NRZ-L)
Pros
Easy to engineer.
Makes good use of bandwidth.
Cons
dc component.
Lack of synchronization capability.
Baseline wondering is also a problem
36
RZ- (Return to Zero)
The main problem with NRZ encoding occurs when the sender and
receiver clocks are not synchronized
The receiver does not know when one bit has
ended and the next bit is starting. One solution is the return-to-zero
(RZ) scheme, which uses three values: positive, negative, and zero
In RZ, the signal changes not between bits but during the bit
The main disadvantage of RZ encoding is that it requires two signal
changes to encode a bit and therefore occupies greater bandwidth
Another problem is the complexity: RZ uses three levels of voltage,
which is more complex to create and discern.
As a result of all these deficiencies, the scheme is not used today.
Instead, it has been replaced by the better-performing Manchester
and differential Manchester schemes
37
RZ
38
Multilevel Binary
Use more than two levels.
Bipolar-AMI.
• Zero represented by no line signal.
• One represented by positive or negative pulse.
• One pulses alternate in polarity.
• No loss of sync if a long string of ones happens (zeros
still a problem).
• No net dc component can use a transformer for
isolating transmission line.
• Lower bandwidth.
• Easy error detection.
39
Pseudoternary
One represented by absence of line signal.
Zero represented by alternating positive and negative
No advantage or disadvantage over bipolar-AMI.
40
Figure 4.9 Bipolar schemes: AMI and pseudoternary
4.41
Trade Off for Multilevel Binary
Not as efficient as NRZ.
• With multi-level binary coding, the line signal may take
on one of 3 levels, but each signal element, which could
represent log23 = 1.58 bits of information, bears only
one bit of information.
• Receiver must distinguish between three levels
(+A, -A, 0).
• Requires approx. 3dB more signal power for same
probability of bit error.
42
Biphase
Manchester.
In Manchester encoding, the duration of the bit is
divided into two halves. The voltage remains at one
level during the first half and moves to the other level in
the second half.
The transition at the middle of the bit provides
synchronization
Low to high represents one.
High to low represents zero.
The idea of RZ (transition at the middle of the bit) and
the idea of NRZ-L are combined to make the
Manchester scheme.
43
Biphase- Differential Manchester
Differential Manchester.
combines the ideas of RZ and NRZ-I. There is always a
transition at the middle of the bit.
the bit values are determined at the beginning of the
bit. If the next bit is 0, there is a transition; if the next
bit is 1, there is none
Mid-bit transition is for clocking only.
Transition at start of a bit period represents zero.
No transition at start of a bit period represents one.
Note: this is a differential encoding scheme.
44
Biphase Pros and Cons
Con.
1. At least one transition per bit time and possibly two.
2. Maximum modulation rate is twice NRZ.
3. Requires more bandwidth.
Pros.
1. Synchronization on mid bit transition (self clocking).
2. No dc component.
3. No baseline wandering
4. Error detection.
• Absence of expected transition points to error in transmission.
45
Modulation Rate
46
Digital to Analog conversion
ANALOG TRANSMISSION
47
2- DIGITAL DATA, ANALOG SIGNAL
Transmitting digital data through PSTN (Public Telephone System)
• 300hz to 3400hz bandwidth.
• Modem (modulator-demodulator) is used to convert
digital data to analog signal and vice versa.
Three basic modulation techniques are used:
1. Amplitude shift keying (ASK).
2. Frequency shift keying (FSK).
3. Phase shift keying (PSK).
48
Figure 5.1 Digital-to-analog conversion
5.49
Figure 5.2 Types of digital-to-analog conversion
5.50
Modulation Techniques
51
Amplitude Shift Keying - ASK
Although we can have several levels (kinds) of signal elements, each
with a different amplitude, ASK is normally implemented using only
two levelsi.e. presence and absence of carrier is used
It is Susceptible to sudden gain changes in voltage.
It is Inefficient in terms of bandwidth usage.
Has a speed of up to 1200bps on voice grade lines.
Used over optical fiber.
In ASK, the amplitude of a single-frequency known as the carrier
frequency is switched between two levels at a rate determined by
the bit rate of the transmitted binary data signal. Bandpass filter is
used to limit the band of frequencies based on Nyquist’s theorem
Examples include Binary Amplitude shift keying (use only two levels)
52
ASK
Vd(t)
Vc(t)
VASK(t)
Signal
frequency spectrum
power
Frequency
fc-3f0 fc-f0 fc fc+f0 fc+3f0
53
Frequency Shift Keying - FSK
In frequency shift keying, the frequency of the carrier signal
is varied to represent data. The frequency of the modulated
signal is constant for the duration of one signal element, but
changes for the next signal element if the data element
changes.
Both peak amplitude and phase remain constant for all signal
elements.Values represented by different frequencies (near
carrier).
It is less susceptible to error than ASK.
Can transmit up to speeds of 1200bps on voice grade lines.
It is used for high frequency radio (3-30 MHz).
Has a higher frequency on LANs using co-ax.
Examples include binary frequency shift keying (two levels)
54
FSK
Data vd(t)
signal
Carrier 1 v1(t)
Carrier 2 v2(t)
vFSK(t)
Signal
power frequency spectrum
Frequency
f1 f2
55
Phase Shift Keying - PSK
In phase shift keying, the phase of the carrier is varied to
represent two or more different signal elements.
Both peak amplitude and frequency remain constant as the
phase changes.
The simplest PSK is binary PSK, in which we have only two
signal elements, one with a phase of 0°, and the other with
a phase of 180“
The other example is muti-level phase shift keying (many
levels)
56
Figure 5.9 Binary phase shift keying
5.57
Quadrature PSK - QPSK
The simplicity of BPSK enticed designers to use 2 bits at a time in each
signal element, thereby decreasing the baud rate and eventually the
required bandwidth.
The scheme is called quadrature PSK or QPSK because it uses two
separate BPSK modulations; one is in-phase, the other quadrature (out-
of-phase)
The incoming bits are first passed through a serial-to-parallel conversion
that sends one bit to one modulator and the next bit to the other
modulator. If the duration of each bit in the incoming signal is T, the
duration of each bit sent to the corresponding BPSK signal is 2T This
means that the bit to each BPSK signal has one-half the frequency of the
original signal
The two composite signals created by each multiplier are sine waves
with the same frequency, but different phases. When they are added,
the result is another sine wave, with one of four possible phases: 45", -
45", 135", and -135".
58
Figure 5.11 QPSK and its implementation
5.59
Performance of Digital to Analog
Modulation Schemes
Bandwidth.
• ASK and PSK bandwidth is directly related to bit rate.
• FSK bandwidth is related to data rate for the lower
frequencies.
• FSK Requires more analog bandwidth than ASK.
In the presence of noise, bit error rate of PSK and
QPSK are about 3dB superior to ASK and FSK.
60
3- ANALOG DATA, DIGITAL SIGNAL
Digitization.
• Conversion of analog data into digital data.
• Digital data can then be transmitted using NRZ-L or using
other codes.
• Digital data can then be converted to analog signal.
• Analog to digital conversion done using a codec.
• Pulse code modulation.
• Delta modulation.
61
Digital transmission
62
Analog data, Digital signal
63
Pulse Code Modulation(PCM)
The most common technique to change an analog
signal to digital data (digitization) is called pulse
code modulation (PCM).
PCM involves three steps:
1. The analog signal is sampled.
2. The sampled signal is quantized.
3. The quantized values are encoded as streams of
bits.
64
Figure 4.21 Components of PCM encoder
4.65
How PCM works
66
How PCM works
1. Sampling
The first step in PCM is sampling. Sampling means
measuring the amplitude of the signal at equal intervals.
The analog signal is sampled every Ts seconds, where
Ts , is the sample interval or period.
The sampling process is sometimes referred to as pulse
amplitude modulation(PAM). We need to remember,
however, that the result is still an analog signal.
According to the Nyquist theorem, to reproduce the
original analog signal, one necessary condition is that
the sampling rate be at least twice the highest
frequency in the original signal.
67
How PCM works
2. Quantization: Refers to a method of assigning integral
values in a specific range to sampled instances. The result of
sampling is a series of pulses with amplitude values between
the maximum and minimum amplitudes of the signal. The
following are the steps in quantization:
3. We assume that the original analog signal has instantaneous
amplitudes between Vmin an Vmax
4. We divide the range into L zones, each of height ∆ (delta).
5. We assign quantized values of 0 to L - 1 to the midpoint of
each zone.
6. We approximate the value of the sample amplitude to the
quantized values.
68
How PCM works
Quantization Error
One important issue is the error created in the quantization
process.
Quantization is an approximation process. The input values to
the quantizer are the real values; the output values are the
approximated values. The output values are chosen to be the
middle value in the zone.
If the input value is also at the middle of the zone, there is no
quantization error; otherwise, there is an error.
3. Encoding
After each sample is quantized and the number of bits per
sample is decided, each sample can be changed to an n bit
code word.
69
How PCM works
70
How PCM works
71
Note
4.72
Delta Modulation - DM
PCM is a very complex technique, thus other techniques
like Delta modulation have been developed to the
complex issues of PCM
PCM finds the value of the signal amplitude for each
sample; DM finds the change from the previous sample
Analog input is approximated by a staircase function.
A staircase function is a function moves up or down one
level () at each sample interval.
Binary behavior.
• Function moves up or down at each sample interval.
73
Delta Modulation - example
74
Figure 4.29 Delta modulation components
4.75
The process of DM
1. The modulator
At the senders’ side a modulator is used to create a
stream of bits from an analog signal.
The process records the small or positive changes
called delta (∆), if positive a 1 is recorded, if negative a
0 is recorded.
However the process needs a base against which the
analog signal is compared; the modulator builds a
second signal that resembles a staircase.
Finding the change is then reduced to comparing the
input signal with the gradually made staircase signal.
76
The process of DM
The modulator, at each sampling interval, compares the
value of the analog signal with the last value of the
staircase signal.
If the amplitude of the analog signal is larger, the next
bit in the digital data is 1; otherwise, it is 0.
The output of the comparator, however, also makes the
staircase itself. If the next bit is l, the staircase maker
moves the last point of the staircase signal delta (∆) up;
it the next bit is 0, it moves it delta (∆) down.
Note that we need a delay unit to hold the staircase
function for a period between two comparisons.
77
The process of DM
2. The Demodulator
The demodulator takes the digital data and
using the staircase marker and the delay unit,
creates the analog signal.
The created analog singal is then passed
through a low pass filter for smoothing.
78
Figure 4.30 Delta demodulation components
4.79
4- ANALOG DATA, ANALOG SIGNALS
Analog to analog conversion or analog modulation is the
representation of analog information by an analog signal.
Modulation is the process of combining an input signal
m(t) and a carrier at frequency fc to produce a signal s(t).
Why modulate analog signals?
• Higher frequency can give more efficient transmission
• Permits frequency division multiplexing.
Types of modulation:
1.Amplitude.
2.Frequency.
3.Phase.
80
Figure 5.15 Types of analog-to-analog modulation
5.81
Amplitude modulation
In AM transmission, the carrier signal is modulated
so that its amplitude varies with the changing
amplitudes of the modulating signal
The frequency and phase of the carrier remain the
same, only the amplitude changes to follow
variations in the information
The modulation creates a bandwidth that is twice
the bandwidth of the modulating signal and covers
a range centered on the carrier frequency. However
the signal components above and below the carrier
frequency carry exactly the same information
82
Figure 5.16 Amplitude modulation
5.83
Frequency modulation
Here, the frequency of the carrier signal is
modulated to follow the changing voltage level
(amplitude) of the modulating signal.
The peak amplitude and phase of the carrier
signal remain constant, but as the amplitude of
the information signal changes the frequency of
the carrier changes correspondingly
84
Figure 5.18 Frequency modulation
5.85
Phase modulation
Here, the phase of the carrier signal is
modulated to follow the changing voltage level
(amplitude) of the modulating signal.
The peak amplitude and frequency of the carrier
signal remain constant, but as the amplitude of
the information signal changes, the phase of the
carrier changes corresspondingly.
86
Figure 5.20 Phase modulation
5.87
Analog Modulation
88
Exercise
Draw the graphs of the NRZ-L scheme, NRZ-I
scheme, Manchester scheme and differential
Manchester scheme using each of the following
data streams, assuming that the last signal level
has been positive.
a. 00000000
b. 11111111
c. 01010101
d. 00110011
89
Next Lecture
Next lecture chapter 6: Bandwidth utilization
multiplexing and spreading.
90