104
Data Communication & Computer Network Chapter -2 Data Encoding

Ch2data Encoding

Embed Size (px)

DESCRIPTION

Data encoding slides data communicationm

Citation preview

Page 1: Ch2data Encoding

Data Communication & Computer Network

Chapter -2Data Encoding

Page 2: Ch2data Encoding

Definition - What does Encoding mean?1. Encoding is the process of converting data into a format

required for a number of information processing needs, including:-Program compiling and execution

-Data transmission, storage and compression/decompression -Application data processing, such as file conversion2.Encoding can have two meanings: In computer technology, encoding is the process of applying a

specific code, such as letters, symbols and numbers, to data for conversion into an equivalent cipher.

In electronics, encoding refers to analog to digital conversion.

Page 3: Ch2data Encoding

Different Conversion Schemes

Page 4: Ch2data Encoding
Page 5: Ch2data Encoding

5

Analog Signals Carrying Analog and Digital Data

Page 6: Ch2data Encoding

6

Digital Signals Carrying Analog and Digital Data

Page 7: Ch2data Encoding

7

Page 8: Ch2data Encoding

Digital to Digital Encoding

Page 9: Ch2data Encoding

Types of Digital to Digital Encoding

Page 10: Ch2data Encoding

04/27/2023 10

Line Coding

DIGITAL DATA INTO DIGITAL SIGNAL

Page 11: Ch2data Encoding

04/27/2023 11

Parameters: Line coding

NO .OF SIGNAL LEVELS: NO OF VALUES ALLOWED IN A SIGNAL TO REPRESENT DATA

Page 12: Ch2data Encoding

04/27/2023 12

Bit rate vs Baud rate

• The bit rate represents the number of bits sent per second, whereas the baud rate defines the number of signal elements per second in the signal.

• Depending on the encoding technique used, baud rate may be more than or less than the bit rate.

Page 13: Ch2data Encoding

04/27/2023 13

DC Component• After line coding, the signal may have zero frequency

component in the spectrum of the signal, which is known as the direct-current (DC) component.

• DC component in a signal is not desirable because the DC component does not pass through some components of a communication system such as a transformer.

• This leads to distortion of the signal and may create error at the output.

• The DC component also results in unwanted energy loss on the line.

Page 14: Ch2data Encoding

04/27/2023 14

Page 15: Ch2data Encoding

04/27/2023 15

• A signal has two data levels with a pulse duration of 1 ms. We calculate the pulse rate and bit rate as follows:

Pulse Rate = 1/ 10-3= 1000 pulses/s

Bit Rate = Pulse Rate x log2 L

= 1000 x log2 2

= 1000 bps

Example 1

Page 16: Ch2data Encoding

04/27/2023 16

Example 2

Pulse Rate = = 1000 pulses/s

Bit Rate = PulseRate x log2 L

= 1000 x log2 4

= 2000 bps

A signal has four data levels with a pulse duration of 1 ms. We calculate the pulse rate and bit rate as follows:

Page 17: Ch2data Encoding

04/27/2023 17

Line Coding Techniques

Page 18: Ch2data Encoding

Unipolar encoding uses only one voltage level.

Note:

Page 19: Ch2data Encoding

04/27/2023 19

Unipolar encoding

Page 20: Ch2data Encoding

Polar encoding uses two voltage levels (positive and negative).

Note:

Page 21: Ch2data Encoding

Types of Polar Encoding

Page 22: Ch2data Encoding

04/27/2023 22

Unipolar • It uses only one polarity

of the voltage level• Bit rate same as baud

rate• DC component present• Loss of synchronization

for longer sequences• Simple but obsolete

Page 23: Ch2data Encoding

04/27/2023 23

NRZ (non return to zero)

• Two voltage levels for binary data• Usually, negative voltage represents one

binary data and positive represents another• Signal level remains same throughout the bit

period• Two schemes of NRZ

– NRZ-L– NRZ-I

Page 24: Ch2data Encoding
Page 25: Ch2data Encoding

04/27/2023 25

NRZ-L

Page 26: Ch2data Encoding

04/27/2023 26

NRZ-I

Page 27: Ch2data Encoding

NRZ-L and NRZ-I Encoding

Page 28: Ch2data Encoding

04/27/2023 28

Page 29: Ch2data Encoding

04/27/2023 29

RZ (Return to Zero)

Three levels Bit rate is double than that of data rate No dc component Good synchronization Main limitation is the increase in bandwidth

Page 30: Ch2data Encoding

3004/27/2023

To ensure synchronization, there must be a signal transition in each bit as shown in Fig.

1: Positive to zero0: Negative to zero

Page 31: Ch2data Encoding

04/27/2023 31

Page 32: Ch2data Encoding

04/27/2023 32

Manchester Coding

Page 33: Ch2data Encoding

In Manchester encoding, the transition at the middle of the bit is

used for both synchronization and bit representation.

Note:

Page 34: Ch2data Encoding

04/27/2023 34

Differential Manchester

Page 35: Ch2data Encoding

In differential Manchester encoding, the transition at the middle of the bit is

used only for synchronization. The bit representation is defined by the

inversion or noninversion at the beginning of the bit.

Note:

Page 36: Ch2data Encoding

Manchester and Diff. Manchester Encoding

Page 37: Ch2data Encoding

In bipolar encoding, we use three levels: positive, zero,

and negative.

Note:

Page 38: Ch2data Encoding

04/27/2023 38

Bipolar encoding

Page 39: Ch2data Encoding

Types of Bipolar Encoding

Page 40: Ch2data Encoding

Bipolar AMI Encoding

Page 41: Ch2data Encoding

B8ZS

• Bipolar With 8 Zeros Substitution• Based on bipolar-AMI• If octet of all zeros and last voltage pulse preceding

was positive encode as 000+-0-+• If octet of all zeros and last voltage pulse preceding

was negative encode as 000-+0+-• Causes two violations of AMI code• Unlikely to occur as a result of noise• Receiver detects and interprets as octet of all zeros

Page 42: Ch2data Encoding
Page 43: Ch2data Encoding

HDB3

• High Density Bipolar 3 Zeros• Based on bipolar-AMI• String of four zeros replaced with one or two

pulses

Page 44: Ch2data Encoding
Page 45: Ch2data Encoding

B8ZS and HDB3

Page 46: Ch2data Encoding

Digital Data, Analog Signal

• Public telephone system– 300Hz to 3400Hz– Use modem (modulator-demodulator)

• Amplitude shift keying (ASK)• Frequency shift keying (FSK)• Phase shift keying (PK)

Page 47: Ch2data Encoding

Figure : Digital-to-analog conversion

Page 48: Ch2data Encoding

Figure : Types of digital-Modulation Techniques

Page 49: Ch2data Encoding

Modulation Techniques

Page 50: Ch2data Encoding

Amplitude Shift Keying (ASK)

• ASK is implemented by changing the amplitude of a carrier signal to reflect amplitude levels in the digital signal.

• For example: a digital “1” could not affect the signal, whereas a digital “0” would, by making it zero.

• The line encoding will determine the values of the analog waveform to reflect the digital data being carried.

Page 51: Ch2data Encoding

Amplitude Shift Keying

• Values represented by different amplitudes of carrier

• Usually, one amplitude is zero– i.e. presence and absence of carrier is used

• Susceptible to sudden gain changes• Inefficient• Up to 1200bps on voice grade lines• Used over optical fiber

Page 52: Ch2data Encoding

Bandwidth of ASK

• The bandwidth B of ASK is proportional to the signal rate S.

B = (1+d)S• “d” is due to modulation and filtering, lies

between 0 and 1.

Page 53: Ch2data Encoding

Figure : Binary amplitude shift keying

Page 54: Ch2data Encoding

Figure : Implementation of binary ASK

Page 55: Ch2data Encoding

Example

We have an available bandwidth of 100 kHz which spans from 200 to 300 kHz. What are the carrier frequency and the bit rate if we modulated our data by using ASK with d = 1?SolutionThe middle of the bandwidth is located at 250 kHz. This means that our carrier frequency can be at fc = 250 kHz. We can use the formula for bandwidth to find the bit rate (with d = 1 and r = 1).

Page 56: Ch2data Encoding

Frequency Shift Keying

• The digital data stream changes the frequency of the carrier signal, fc.

• For example, a “1” could be represented by f1=fc +f, and a “0” could be represented by f2=fc-f.

Page 57: Ch2data Encoding

Frequency Shift Keying

• Values represented by different frequencies (near carrier)

• Less susceptible to error than ASK• Up to 1200bps on voice grade lines• High frequency radio• Even higher frequency on LANs using co-ax

Page 58: Ch2data Encoding

Figure : Binary frequency shift keying

Page 59: Ch2data Encoding

Bandwidth of FSK

• If the difference between the two frequencies (f1 and f2) is 2f, then the required BW B will be:

B = (1+d)xS +2f

Page 60: Ch2data Encoding

Example

We have an available bandwidth of 100 kHz which spans from 200 to 300 kHz. What should be the carrier frequency and the bit rate if we modulated our data by using FSK with d = 1?

SolutionThis problem is similar to Example 5.3, but we are modulating by using FSK. The midpoint of the band is at 250 kHz. We choose 2Δf to be 50 kHz; this means

Page 61: Ch2data Encoding

Figure : Implementation of BFSK

Page 62: Ch2data Encoding

Example

We need to send data 3 bits at a time at a bit rate of 3 Mbps. The carrier frequency is 10 MHz. Calculate the number of levels (different frequencies), the baud rate, and the bandwidth.

SolutionWe can have L = 23 = 8. The baud rate is S = 3 Mbps/3 = 1 Mbaud. This means that the carrier frequencies must be 1 MHz apart (2Δf = 1 MHz). The bandwidth is B = 8 × 1M = 8M.

Page 63: Ch2data Encoding

Figure : Bandwidth of MFSK

Page 64: Ch2data Encoding

Phase Shift Keyeing

• We vary the phase shift of the carrier signal to represent digital data.

• The bandwidth requirement, B is:B = (1+d)xS

• PSK is much more robust than ASK as it is not that vulnerable to noise, which changes amplitude of the signal.

Page 65: Ch2data Encoding

Phase Shift Keying

• Phase of carrier signal is shifted to represent data

• Differential PSK– Phase shifted relative to previous transmission

rather than some reference signal

Page 66: Ch2data Encoding

Figure : Binary phase shift keying

Page 67: Ch2data Encoding

Figure : Implementation of BPSK

Page 68: Ch2data Encoding

Quadrature PSK

• To increase the bit rate, we can code 2 or more bits onto one signal element.

• In QPSK, we parallelize the bit stream so that every two incoming bits are split up and PSK a carrier frequency. One carrier frequency is phase shifted 90o from the other - in quadrature.

• The two PSKed signals are then added to produce one of 4 signal elements. L = 4 here.

Page 69: Ch2data Encoding

Quadrature PSK

• More efficient use by each signal element representing more than one bit– e.g. shifts of /2 (90o)– Each element represents two bits– Can use 8 phase angles and have more than one

amplitude– 9600bps modem use 12 angles , four of which

have two amplitudes

Page 70: Ch2data Encoding

Figure : QPSK and its implementation

Page 71: Ch2data Encoding

Example

Find the bandwidth for a signal transmitting at 12 Mbps for QPSK. The value of d = 0.

SolutionFor QPSK, 2 bits is carried by one signal element. This means that r = 2. So the signal rate (baud rate) is S = N × (1/r) = 6 Mbaud. With a value of d = 0, we have B = S = 6 MHz.

Page 72: Ch2data Encoding

Performance of Digital to Analog Modulation Schemes

• Bandwidth– ASK and PSK bandwidth directly related to bit rate– FSK bandwidth related to data rate for lower

frequencies, but to offset of modulated frequency from carrier at high frequencies

– (See Stallings for math)• In the presence of noise, bit error rate of PSK

and QPSK are about 3dB superior to ASK and FSK

Page 73: Ch2data Encoding

Analog to Digital Encoding

Page 74: Ch2data Encoding

PAM

Page 75: Ch2data Encoding

PAM: Pulse Amplitude Modulation

Page 76: Ch2data Encoding

Pulse amplitude modulation has some applications, but it is not used by itself in data communication. However, it is the first step in another very popular

conversion method called pulse code modulation.

Note:

Page 77: Ch2data Encoding

Quantized PAM signal

Page 78: Ch2data Encoding

Quantizing by using sign and magnitude

Page 79: Ch2data Encoding

PCM

Page 80: Ch2data Encoding

From analog signal to PCM digital code

Page 81: Ch2data Encoding
Page 82: Ch2data Encoding
Page 83: Ch2data Encoding

According to the Nyquist theorem, the sampling rate must be at least 2 times

the highest frequency.

Note:

Page 84: Ch2data Encoding

Nyquist theorem

Page 85: Ch2data Encoding

Example 4

What sampling rate is needed for a signal with a bandwidth of 10,000 Hz (1000 to 11,000 Hz)?

Solution

The sampling rate must be twice the highest frequency in the signal:

Sampling rate = 2 x (11,000) = 22,000 samples/s

Page 86: Ch2data Encoding

Example 5

A signal is sampled. Each sample requires at least 12 levels of precision (+0 to +5 and -0 to -5). How many bits should be sent for each sample?

Solution

We need 4 bits; 1 bit for the sign and 3 bits for the value. A 3-bit value can represent 23 = 8 levels (000 to 111), which is more than what we need. A 2-bit value is not enough since 22 = 4. A 4-bit value is too much because 24 = 16.

Page 87: Ch2data Encoding

Example 6

We want to digitize the human voice. What is the bit rate, assuming 8 bits per sample?

Solution

The human voice normally contains frequencies from 0 to 4000 Hz. Sampling rate = 4000 x 2 = 8000 samples/s

Bit rate = sampling rate x number of bits per sample = 8000 x 8 = 64,000 bps = 64 Kbps

Page 88: Ch2data Encoding

Analog to Analog Modulation

Page 89: Ch2data Encoding
Page 90: Ch2data Encoding
Page 91: Ch2data Encoding

Amplitude Modulation

Page 92: Ch2data Encoding

AM Bandwidth

Page 93: Ch2data Encoding

AM Band Allocation

Page 94: Ch2data Encoding

Frequency Modulation

Page 95: Ch2data Encoding

FM Bandwidth

Page 96: Ch2data Encoding

FM Band Allocation

Page 97: Ch2data Encoding

Transmission Mode

Parallel Transmission

Serial Transmission

Page 98: Ch2data Encoding

Data transmission

Page 99: Ch2data Encoding

Parallel transmission

Page 100: Ch2data Encoding

Serial transmission

Page 101: Ch2data Encoding

In asynchronous transmission, we send 1 start bit (0) at the beginning

and 1 or more stop bits (1s) at the end of each byte. There may be a gap

between each byte.

Note:

Page 102: Ch2data Encoding

Asynchronous transmission

Page 103: Ch2data Encoding

In synchronous transmission, we send bits one after another without

start/stop bits or gaps. It is the responsibility of the receiver to

group the bits.

Note:

Page 104: Ch2data Encoding

Synchronous transmission