Top Banner
CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang
68

CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Jan 11, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

CSC 335 Data Communications

and Networking

Lecture 3: Signal Encoding and Conversion

Dr. Cheer-Sun Yang

Page 2: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Motivation

How is information coded in a format suitable for transmission?

• What are the available communication services and devices today?

• How are bits encoded into electric signals?

• How are analog signals and digital signals converted?

Page 3: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Communication Services and Devices

• Telephone System – switching technique and routing methods are the two main design issues.

• Integrated Services Digital Network• Cellular Phones – the sender and receiver

can move• Fax Machines• Computers

Page 4: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Data Encoding

• ASCII (American Standard Code for Information Interchange)

• EBCDIC (Extended Binary Coded Decimal Interchange Code)

• Others – Baudot, morse, BCD

Page 5: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Electric Current and Data Bits

The simplest electronic communication systems use a small electric current to encode data. Positive voltage – represents 0 (or 1)Negative voltage – represents 1 (or 0) A waveform diagram can be used to illustrate how data bits are represented and transmitted.

Page 6: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Electric Current and Data Bits

A waveform diagram provides a visual representation of how an electrical signal varies over time. For example, the diagram shows that a longer time elapsed between the transmission of the fourth and the fifth bits than between others.

Page 7: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Digital Encoding Schemes Using Digital Signals

• Nonreturn to Zero-Level (NRZ-L)

• Nonreturn to Zero Inverted (NRZI)

• Manchester

• Differential Manchester

Page 8: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Nonreturn to Zero-Level (NRZ-L)

• Two different voltages for 0 and 1 bits• Voltage constant during bit interval

– no transition I.e. no return to zero voltage

• e.g. Absence of voltage for zero, constant positive voltage for one

• More often, negative voltage for one value and positive for the other

• This is NRZ-L

Page 9: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Nonreturn to Zero Inverted

• Nonreturn 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

Page 10: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

NRZ

Page 11: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

NRZ pros and cons• Pros

– Easy to engineer– Make good use of bandwidth

• Cons– dc component– Lack of synchronization capability and hard to

synchronize timing of sender and receiver.• Used for magnetic recording• Not often used for signal transmission

Page 12: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Differential Encoding

• Data represented by changes rather than levels

• More reliable detection of transition rather than level

• In complex transmission layouts it is easy to lose sense of polarity

Page 13: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Manchester

• Transition in middle of each bit period

• Transition serves as clock and data

• Low to high represents one

• High to low represents zero

• Used by IEEE 802.3

Page 14: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Advantages of Manchester

• Synchronization: Because there is a predictable transition during each bit time, the receiver can synchronize on that transition.

• Error detection: Noise on the line would have to invert both the signal before and after to cause an undetected error.

Page 15: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

How are bits encoded into digital signals?

• Exercise with a neighbor now.• Draw a waveform diagram depicting the

message “Hi” using NRZL, NRZI, and Manchester encoding schemes.– Assume that the bit representation of “H” is 0 1 0 0 1 0 0 0 = 0X48– Assume that the bit representation of “i” is 0 1 1 0 1 0 0 1 = 0X69

Page 16: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Limitation

• Digital signals cannot be used to transmit across a long distance.

• During transmitting digital signals, it is susceptible to interference easily.

• Digital encoding schemes are widely used in recording.

• Instead, analog signals are used to transmit even digital data bits. How?

Page 17: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Analog Signals

• Digital computers are incompatible with analog transmission media such as phone lines.

• How can one use analog signals to represent digital data bits?

• We need to convert digital data to analog signal at the sender side and convert analog data back to digital data at the receiver side.

Page 18: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Fundamental of Communications

• Fourier Series Approximation

• Nyquist Theorem

• Shannon’s Theorem

• Modulation and Demodulation

Page 19: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.
Page 20: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

We can addsines together to make new functions...

g2(t)=1/3sin(2( 3f )t)

g1(t)=sin(2f t)

g3(t)= g1(t) + g2(t)

Page 21: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Fourier Transform

Jean B. Fourier found that

any periodic function can be expressed as an infinite sum of sine function.

11

0 /2sin/2cos2

1)(

ni

ni PitbPitaats

Page 22: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.
Page 23: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Baud Rate vs. Bit Rate

• Transmission speed can be measured in bits per second(bps).

• Technically, transmission is rated in baud, the number of changes in the signal per second that the hardware generates.

• Using RS-232 standard to communicate, bit rate rate = baud rate.

• In general, bit rate rate = N * baud rate, where N is the number of signals in a string.

Page 24: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Baud Rate vs. Bit Rate• Sender sends the bit string, by b1 b2 … bn.• The transmitter alternately analyzes each string and

transmits a signal component uniquely determined by the bit values. Once the component is sent, the transmitter gets another bit string and repeats this process.

• The different signal components make up the actual transmitted signal. The frequency with which the components change is the baud rate.

• At the receiving end, the process is reversed.The receiver alternately samples the incoming signal and generates a bit string.

Page 25: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Baud Rate vs. Bit Rate

• Consequently, the bit rate depends on two things: the frequency with which a component can change (baud rate) and n, the number of bits in the string. That is why the formula:(signal may have up to 2n

different amplitudes)

bit rate = n * baud rate

Page 26: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Nyquist Sampling Theorem• Due to Harry Nyquist (1920)• Nyquist showed that if ƒ is the maximum frequency the

medium can transmit, the receiver can completely reconstruct by sampling it 2ƒ times per second on a perfectly noiseless channel.

• In other words, the receiver can reconstruct the signal by sampling it at intervals of 1/(2ƒ) second.

• For example, if the max frequency is 4000 Hz, the receiver needs to sample the signal 8000 times per second or using 2ƒ as the baud rate.

• Bit rate = 2ƒ * n. (See Table 2.9)

Page 27: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Any Limit on Bit Rate?

• The formula Bit rate = 2ƒ * n seems to imply that there is no upper bound for the data rate given the maximum frequency. Unfortunately, this is not true for two reasons.

Page 28: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

How about real hardware?

• First, if we used amplitude to represent data bits, each time we separate the amplitude into smaller ranges to represent more data bits, the receiver must be more sophisticated (and more expensive) to be able to detect smaller differences. If the differences become too small, we eventually exceed the ability of a device to detect them.

Page 29: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

How about real hardware?

• Second, many channels are actually subject to noise.

Page 30: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Limitation on Real Hardware

Page 31: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Signal-to-Noise Ratio

• S/N is known as the signal-to-noise ratio in decibles.

• Because S is usually much larger than N, the ration is often scaled down logarithmically and the unit is measured in bels and 1 dB = 0.1 bel.

• So when we refer to signal-to-noise ration, we should be careful about units.

Page 32: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Signal-to-Noise Ratio

• Electrical engineers uses S/N to indicate the quality of sound. The higher the ration is, the better the quality is.

• B = log 10 (S/N) bels, where B is the quality rate measured in bels.

• S/N is known as the signal-to-noise ratio measured in decibles.

• If B=2.5 bels, then S = ___________N?

Page 33: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Shannon’s Theorem

• Bit rate = Bandwidth * log 2 (1+S/N) bps.

• According to this result, a bit rate around 35,000 bps is an upper limit for conventional modems.

Page 34: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Shannon’s Theorem and 56KModem

• According to this result, a bit rate around 35,000 bps is an upper limit for conventional modems.

• However, a 56kbps modem can achieve the high rates when used to connect with an ISP. As such, it takes advantage of the fact that there is no analog-to-digital conversion at the ISP site.

Page 35: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Example of Shannon’s Theorem

• Bandwidth = 3000 Hz,

• Quality rate = 35 dB or 3.5 bels,

• What is the bit rate?

• Please work with your neighbors now.

• Hint: You must find S/N first.

Page 36: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Motivation on Modulation and Demodulation

If either analog or digital signals were used exclusively, communications would be simplified. However, this is impossible especially attempting to send signals across a long distance. Digital signals cannot be transmitted far without being converted to analog signals. Because telephone system is an analog device, computer signals must be converted to analog signals.

Page 37: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

The Waveform of a Carrier

The wave form of an analog signal carrier oscillates continuously even when no signal is being sent.

Page 38: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Carrier

• Researchers found that a continuous, oscillating signal will propagate farther than other signals.

• Instead of transmitting an electric current that only changes when the value of a bit changes, long-distance communication systems send a continuously oscillating signal, usually a sine wave, called a carrier.

Page 39: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Data Modulation• To send data, a transmitter modifies the

carrier slightly.

• Collectively, such modifications are called modulation.

• The technique was originated for transmitting radio or TV signals.

• Generally speaking, modulation is the process to transform a digital signal into an analog signal.

Page 40: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Data Demodulation

• At the receiving end, the analog signal is transformed back to digital signals.

• The process is called demodulation.

• The device to perform modulation and demodulation is called a modem. We will talk about modem later.

Page 41: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Example of Data Modulation

The digital signal ’01’ is sent. The carrier is reduced to 2/3 full strength to encode a 1 bit and 1/3 strength to encode a 0 bit.

Page 42: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Modulation Techniques

• Amplitude shift keying (ASK)

• Frequency shift keying (FSK)

• Phase shift keying (PK)

Page 43: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Modulation Techniques

Page 44: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Modulation Techniques

This modulation technique is called Amplitude Shift keying (ASK) technique.

Page 45: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

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

Page 46: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Example of ASK

Bit Values Amplitude

00 A1

01 A2

10 A3

11 A4

Page 47: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Amplitude Shifting Keying (four amplitudes), two bits per baud

Page 48: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Phase Shift Keying• Nyquist Theorem suggests that the number

of bits sent per cycle can be increased if the encoding scheme permits multiple bits to be encoded in a single cycle of the carrier.

• ASK and FSK work well but require at least one cycle of a carrier wave to send a single bit.

• PSK changes the timing of the carrier wave abruptly to encode data. Such change is called a phase shift.

Page 49: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Example of Phase Shift

Page 50: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Phase Shift Keying

Arrows indicate points at which the carrier abruptly jumps to a new position in the cycle. For different code, the phase shift is different.

Page 51: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Frequency Shift Keying

Page 52: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

QAM

• Any of the simple techniques can be used with any number of different signals.

• More signals means a greater bit rate with a given baud rate.

• The problem is that a higher bit rate requires more signals and reduces the differences among them and makes the receiver’s job more difficult.

Page 53: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

QAM(cont’d)

• Another approach is to use a combination of frequencies, amplitudes, or phase shifts, which allows us to use a larger group of legitimate signals while maintaining larger differences among them.

• One technique is Quadrature Amplitude Modulation (QAM), in which a group of bits is assigned a signal defined by its amplitude and phase shift.

Page 54: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Signal Associations for QAM

Page 55: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Two amplitudes and four phases are used to send three bits per baud.

Page 56: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

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

• In the presence of noise, bit error rate of PSK and QPSK are about 3dB superior to ASK and FSK

Page 57: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Analog-to-Digital Conversion• Usually, it is the reverse of what we have

just discussed. A modem examines the incoming signals for amplitude, frequencies, and phase shifts and generates digital signals. This works for signals having constant characteristics.

• What about analog signals whose characteristics change continually such as a voice signal?

Page 58: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Pulse Code Modulation

• One way of making the signal truly digital is to assign amplitudes from a predefined set to the sample signals.

• This process is called PCM.

Page 59: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.
Page 60: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

The pulse amplitude is divided into eight values or 23 values.

Page 61: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Accuracy of PCM

1. The sampling frequency

2. The number of amplitudes chosen: in Fig 2.47, the resulted signal becomes distorted.

Page 62: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.
Page 63: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Modem

• Modem = modulator + demodulator• A modem converts digital signals to analog signals before sending them across a phone line.• Another modem converts analog signals back to digital signals before passing them to a receiver.

Page 64: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Illustration of Dial-up Modem

Page 65: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Modems• Intelligent Modems (Hayes Compatible)

– A user can enter commands such as continuing dialing, beeping when disconnected, etc.

– Hayes Modem allows a user to enter AT command to request for connection.

– ATDT5551234: AT represents AT command; D stands for dial; T stands for tone dialing.

• Cable Modems – connects to cable TV carrier from a PC and a TV.

• Null Modems – used for connecting two local PC’s together. (will be discussed again in next chapter)

Page 66: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

3Com Cable Modem

Page 67: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Summary of ModemA pair of modem is required for long-distance communication across a leased line; each modem contains separate circuitry to send and receive digital data. To send data, a modem emits a continuous carrier wave, which it then modulates according to the values of the bits being transferred. To receive data, a modem detects modulation in the incoming carrier, and uses it to recreate the data bits.

Page 68: CSC 335 Data Communications and Networking Lecture 3: Signal Encoding and Conversion Dr. Cheer-Sun Yang.

Assignment

• Read Chapter 2

• Exercises