Chapter 5: Signal Encoding Techniques Pars Mutaf International Computer Institute DATA AND COMPUTER COMMUNICATIONS – WILLIAM STALLINGS - 7th EDITION Signal encoding ● ● Digital data, digital signal – Less complex – Less expensive Analog data, digital signal – ● Digital data, analog signal – ● Sometimes, it is more advantageous to shift to digital domain Some transmission media (unguided media, optical fiber) only propagate analog signals Analog data, analog signal – Modulation to higher frequency allows ● ● Long distance transmission Frequency Division Multiplexing Digital data, digital signal ● Digital signal ● Discrete, discontinuous voltage pulses ● Each pulse is a signal element ● Binary data encoded into signal elements Encoding schemes (or, line codes) ● ● ● ● Goal: Reliably transmitting data bits to the receiver despite line noise and other transmission impairments, and as fast as possible. Resulting bandwidth of the signal (after encoding) should not be too high so that it can be transmitted over low quality links. Or, we should be able to send data at a high rate. Signal power should be concentrated in the middle of bandwidth (sharp frequency spectrum) Encoding schemes ● Good clock synchronization – ● No DC component – – ● The maximum number of consecutive ones or zeros is bounded to a reasonable number. Most long-distance communication channels cannot transport a DC component. Lack of DC component allows AC coupling via transformer, providing isolation and reducing interference Error detection – Error detection should be built in signal encoding scheme, if possible. Encoding schemes types ● Unipolar – ● Polar – ● One logic state represented by positive voltage the other by negative voltage Differential – ● All signal elements have same sign Data represented by signal level changes rather than signal levels Multilevel binary – Use more than two voltage levels Encoding schemes ● Nonreturn to Zero-Level (NRZ-L) ● Nonreturn to Zero Inverted (NRZI) ● Bipolar AMI (Alternate Mark Inversion) ● Pseudoternary ● Manchester ● Differential Manchester ● B8ZS ● HDB3 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 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 ● Example of differential encoding NRZ NRZ pros and cons ● Pros – – ● Cons – – – ● Easy to engineer Make good use of bandwidth Lack of synchronization capability In case of long string of 1s or 0s (for NRZ-L) or long string of 0s for NRZ-I, synchronization between transmitter and receiver may be lost due to clock drift. DC component Used for magnetic recording, RS-232 etc. Bipolar AMI (Alternate Mark Inversion) ● Multilevel ● 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 (zeros still a problem) ● Lower bandwidth ● Easy error detection Pseudoternary ● ● ● ● One represented by absence of line signal Zero represented by alternating positive and negative No advantage or disadvantage over bipolarAMI 0 = positive or negative level, alternating for successive zeros, 1= no line signal. Bipolar-AMI and Pseudoternary 0 1 0 0 1 1 0 0 0 1 1 Bipolar-AMI and Pseudoternary pros and cons ● Pros – – ● Reduced DC component Error detection Cons Receiver needs to distinguish three levels (+A, -A, 0) Requires more signal power for same probability of bit error – ● ● Synchronization problem when long strings of 0s in the case of Bipolar AMI and 1s with Pseudoternary Bit error rate Manchester (biphase) ● ● 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, the media access control (MAC) sublayer of wired Ethernet. Differential Manchester – Midbit transition is clocking and error detection – Transition at start of a bit period represents zero – No transition at start of a bit period represents one – Used by IEEE 802.5 (token ring). Manchester Manchester pros and cons ● Con – – – ● At least one transition per bit time and possibly two Maximum modulation rate is twice NRZ (explained in the next slide) Requires more bandwidth Pros – – – Synchronization on mid bit transition (self clocking) Error detection (absence of expected transition) No DC component Modulation rate ● Data rate and modulation rate may differ ● The data rate or bit rate is 1/Tb where Tb is bit duration ● ● The modulation rate (also called baud rate) is the rate at which signals are generated For Manchester encoding the modulation rate is twice the data rate (consumes more bandwidth) Modulation rate low->high : 1 Scrambling (B8ZS and HDB3) ● ● ● ● Manchester encoding solves the bit synchronization problem at the cost of higher modulation rate Manchester encoding techniques are mostly used in LANs which have high bandwidth Since high signaling rate is required relative to data rate, these techniques are not suitable for long distance transmission Scrambling techniques improve this rate by replacing long sequences of zeros by a fixed pattern that is unlikely to be caused by noise or other transmission impairments 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 HDB3 ● High Density Bipolar 3 zeros ● Based on bipolar-AMI ● Fourth zero replaced by a code violation B8ZS and HDB3 +0+: invalid 0-: invalid 0-:invalid +-+:invalid B8ZS and HDB3 ● Cons – – ● Complexity No solution for 7 consecutive 0s Pros – – – Synchronization Error detection No DC component Comparison Comparison ● ● ● ● Most of the energy in NRZ and NRZI signals is between DC and half the bit rate, but main limitations are: lack of synchronization and presence of DC component Bipolar AMI and pseudoternary signals have less bandwidth (this is good) than NRZ, and there is no net DC component Wider bandwidth with Manchester, but best synchronization and error detection B8ZS and HDB3 have a sharp spectrum and suitable for high data rate transmission, also good synchronization, no DC component and error detection. 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 (PSK) Modulation Techniques Amplitude Shift Keying (1) ● ● Values represented by different amplitudes of carrier Usually, one amplitude is zero – ● ● ● i.e. presence and absence of carrier is used Inefficient and susceptible to noise (a 1 may be changed to 0, and 0 to 1) Up to 1200bps on voice grade lines Used over optical fiber (one signal element is light pulse, the other is absence of light). Amplitude Shift Keying (2) Acos (2πfct) if 1 0 if 0 s(t) = Binary Frequency Shift Keying (1) ● ● Most common form is binary FSK (BFSK) Two binary values represented by two 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 Binary Frequency Shift Keying (2) Acos (2πf1t) if 1 Acos (2πf2t) if 0 s(t) = Multiple FSK ● ● More than two frequencies used Each signalling element represents more than one bit ● More bandwidth efficient ● More prone to error FSK on Voice Grade Line Voice grade line will pass frequencies between 300 and 3400 hz. 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 Acos (2πfct + Φ) if 1 s(t) = Acos (2πfct) if 0 Differential PSK 1 represented by a phase shift Quadrature PSK (1) ● More efficient use by each signal element representing more than one bit – – – – Shifts of π/2 (90o) Each element represents two bits Can use 8 phase angles and have more than one amplitude 9600bps modem uses 12 angles, four of which have two amplitudes Quadrature PSK (2) s(t) = Acos (2πfct + π/4) Acos (2πfct)+ 3π/4) Acos (2πfct + 5π/4) Acos (2πfct + 7π/4) if 11 if 10 if 00 if 01 Bandwidth ● ● ● ● For ASK and PSK the bandwidth is given as BT = (1 + r) R, where R is the bit rate and r is a constant between 0 and 1. For FSK, the bandwidth is given as BT = 2 ΔF + (1 + r) R, where ΔF = f2 – fc = fc – f1 For multilevel PSK, bandwidth can be given as BT = ((1 + r)/ log2 M)R, where M is the number of different signal elements. For multilevel FSK, we have, BT = ((1 + r)M/ log2M)R Analog data, digital signal ● ● ● ● Conversion of analog data into digital data Digital data can then be transmitted using digital signal encoding techniques (e.g. NRZ-L, B8ZS, Bipolar AMI, etc.) Digital data can then be converted to analog signal Analog to digital conversion done using a codec – – Pulse code modulation Delta modulation Why go digital? ● Repeaters can be used instead of amplifiers ● Data compression and encryption is possible Digitizing analog data Pulse Code Modulation (PCM) ● Nyquist Theorem: Let signal bandwidth B – Let sampling rate f – If f>2B, then the samples will contain all the information of the original signal – f is called the Nyquist rate. Voice data limited to below B=4000Hz, requiring f=8000 sample per second – ● ● Each sample assigned digital value and sent over the transmission medium PCM example Pulse Code Modulation (PCM) ● ● ● ● Voice data limited to below 4000Hz, requiring 8000 samples per second 8 bit sample gives 256 levels (Compact Disc uses 16 bits) 8000 samples per second of 8 bits each gives 64kbps Data compression can improve this Delta modulation ● ● ● ● Analog input is approximated by a staircase function Move up or down one level (δ) at each sample interval Binary behavior Function moves up or down at each sample interval Delta modulation example Delta modulation ● ● Used when quality is not of primary importance. The transmitted data is reduced to a 1-bit data stream – – ● 1 means increase 0 means decrease To achieve high signal-to-noise ratio, delta modulation must use oversampling techniques, that is, the analog signal is sampled at a rate several times higher than the Nyquist rate. Analog data, analog signals ● ● ● ● Why modulate analog signals? Higher frequency can give more efficient transmission Permits frequency division multiplexing (Chapter 8) Types of modulation – – – Amplitude Frequency Phase Analog modulation Amplitude modulation s t =[1na x t ]cos 2πf c t where, DC component removed by cos 2πfct is the carrier, x(t) is the input signal, normalized to unity amplitude na is the modulating index (na <1, otherwise signal envelop will cross the time axis and information will be lost) m(t)=nax(t) Amplitude modulation