Data Communication & Networking CSCI 3342 Dr. Thomas Hicks Computer Science Department Trinity University 1 1 Digital To Digital Encoding 2 Major 4 Encoding Methods Digital-ToDigital Analog-ToDigital Digital-ToAnalog Analog-ToAnalog Binary Data Must Be Encoded/Converted To A Form That Will Propagate Over A Wire 3 Digital To Digital Encoding Digital To Digital Encoding – Converting Binary 0’s and 1’s Into A Sequence Of Voltage Pulses That Can Propagate Over A Wire. Transmit Data From Computer To Printer 4 Signal Encoding Signal Level Data Level 5 Signal Level vs. Data Level 6 Pulse Rate & Bit Rate 7 Pulse Rate = No Pulses Per Second Bit Rate = No Bits Per Second If the pulse carries only one bit, the Bit Rate = Pulse Rate [Not Always The Case] 8 General Case: BitRate = PulseRate x log2 L L = # Data Levels BitRate = PulseRate x log2 DataLevels 9 Example 1 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 10 Example 2 A signal has four 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 = PulseRate x log2 L = 1000 x log2 4 = 2000 bps 11 DC Components 12 We Shall Examine Numerous Coding Schemes Most Coding Schemes Will Have Values Above & Below The Line Positive & Negative Values. 10110001 13 DC Component Coding Schemes Some coding schemes have a residual DC [Direct-Current] that has a zero frequency. The positive and negative voltages do not cancel each other. 10110001 This extra energy on the line is useless and will not pass properly through Transformers! Bad! 14 Synchronization 15 The Receiver's Bit Intervals Must Match The Sender's Bit Intervals If The Signal Is To Be Interpreted Correctly! We Must Have Some Way Of Synchronizing The Signal! 16 Lack Of Synchronization 17 Example 3 In a digital transmission, the receiver clock is 0.1 percent faster than the sender clock. How many extra bits per second does the receiver receive if the data rate is 1 Kbps? How many if the data rate is 1 Mbps? Solution At 1 Kbps: 1000 bits sent 1001 bits received1 extra bps At 1 Mbps: 1,000,000 bits sent 1,001,000 bits received1000 extra bps 18 Many Line Coding Schemes 19 Only Some Of Major Encoding Methods! Unipolar Polar Bipolar AMI NRZ NRZ-L NRZ-I RZ Manchester B8ZS HDB3 ETC Differential Manchester 20 You May Make A 5"x8" Card To Use On Exam (May Include Titles & Images) NRZ-L 21 Unipolar 22 Unipolar Encoding uses only One Voltage Level. 23 Unipolar Encoding 24 Unipolar Encoding -1 Unipolar uses either a Positive Or Negative Unipolar – Very Simple & Very Primitive Encoding Scheme (almost obsolete) Unipolar – Only one polarity. Sending Voltage Pulses along a medium link (usually a wire or cable) Voltage Level = 1’s Zero Voltage Level = 0’s Not Essential Assignment, But Logical! 25 Unipolar Encoding -2 Unipolar Requires DC Component Average Amplitude Is Non-Zero Not All Mediums Can Handle A DC Component Unipolar Requires Synchronization No Way Receiver Can Determine Beginning Or End Problem With A Long, Uninterrupted Series Of 1’s Problem With A Long, Uninterrupted Series Of 0’s Solution To Synchronization Problem – Use A Separate Parallel Line To Carry Clock Pulse Doubling # Lines Expensive 26 Polar 27 Polar Encoding uses two voltage levels (positive and negative?) 28 Types Of Polar Encoding 29 Polar Encoding Polar Encoding – Uses Two Voltage Levels –> 0 Positive & 1 Negative – or Visa Versa Average Amplitude is 0 DC Component Not Needed 4+ Types Of Polar Encoding NRZ RZ Manchester Differential Manchester 30 NRZ-L Encoding (Polar) 31 Polar NRZ-L Encoding In Polar NRZ-L the Level of the Signal is Dependent upon the State of the Bit. 32 Polar Encoding NRZ-L NRZ - NonReturn to Zero – Two Most Popular Methods Are NRZ-L and NRZ-I NRZ-L Usually 0 Positive & 1 Negative {For Us!} Biggest Problem With Long Stream Of 1’s or 0’s [Clocks Might Not Be Synchronized] 33 NRZ-L Practice Sketch The NRZ-L Encoding For The Signal Below. 34 NRZ-I Encoding (Polar) 35 In NRZ-I the signal is Inverted If a 1 is Encountered. 36 Polar Encoding NRZ-I NRZ-I An Inversion Of The Voltage Represents 1 If Pos Neg If Neg Pos No Change Represents 0 Synchronization Occurs With Every 1 Bit 0’s Can Still Cause Problem – More 1’s Than 0’s 0 First Pos 1 First Neg Next Bit Is 1 37 NRZ-I Practice Sketch The NRZ-I Encoding For The Signal Below. 38 RZ Encoding (Polar) 39 Polar RZ RZ - Return to Zero – A Signal Change With Every Bit To Assure Synchronization Several Solutions RZ Positive Voltage Means 1 Negative Voltage Means 0 Signal Returns To 0 Voltage Half-Through 40 Polar RZ RZ – 3 Levels Of Amplitude – 3 Voltage Levels 41 Polar RZ Practice Sketch The RZ Encoding For The Signal Below. 42 A Good Encoded Digital Signal Must Contain a Provision for Synchronization. 43 Manchester Encoding (Polar) 44 In Manchester Encoding, the Transition at the Middle of the Bit is used for both Synchronization and Bit Representation. 45 Polar Manchester Manchester Positive To Negative Transition For 0 Negative To Positive Transition For 1 Two Levels Of Amplitude Inversion At Middle Middle Of Bit Time 46 Polar Manchester (cont) Manchester Inversion At Middle Middle Of Bit Time Synch Signal Change Middle Of Each Bit Green Blue 47 Polar Manchester Practice Sketch The Manchester Encoding For The Signal Below. Two Levels Of Amplitude Same Synchronization As RZ 48 I Would Provide KEY Manchester 49 Differential Manchester Encoding (Polar) 50 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 Non-Inversion at the beginning of the bit. 51 Polar Differential Manchester Differential Manchester Synch Signal Change Middle Of Each Bit Inversion At Beginning Of Bit Time Transition At Start Of Bit Time = 0 No Transition At Start Of Bit Time = 1 2 Signal Changes For 0, 1 Signal Change for 1 52 Polar Differential Manchester Practice Sketch The Differential Manchester Encoding For The Signal Below. 53 Bipolar 54 In Bipolar Encoding, we use Three Levels: positive, zero, and negative. 55 Bipolar Bipolar – Three Most Most Common Solutions – AMI, B8ZS, & HDB3 Uses 3 Voltage Levels Positive, Negative, Zero Zero Level Is 0 Alternating Positive & Negative Are 1 56 AMI Encoding (Bipolar) 57 Bipolar - AMI AMI – Alternate Mark Inversion Mark In Telegraphy Means 1 Zero Voltage Represent 0 Alternating Positive & Negative Represent 1 Synchronize Long Sequence 1’s No Synchronize Long Sequence 0’s DC Component = 0 58 Bipolar AMI Practice Sketch The AMI Encoding For The Signal Below. 59 Bipolar - Pseudoternary “A Variation Of Bipolar AMI is called Pseudoternary, In Which Binary 0’s Alternate Between Positive & Negative Voltages.” 60 BZPS Encoding (Bipolar) 61 Bipolar – BZPS B8ZS – Bipolar 8 Zero Substitution Same As AMI Until 8 Consecutive 0’s Use Chart Below [Will Be Provided On Exam/ Quiz] 62 Bipolar – B8ZS Practice Sketch The B8ZS Encoding For The Signal Below. 63 Bipolar – HDB3 HDB3 – High Density Bipolar 3 Similar To B8ZS – Except Done In Sets Of 4 Use Chart Below [Will Be Provided On Exam/ Quiz] 64 2B1Q Encoding (Bipolar) 65 2B1Q Encoding 2 Binary 1 Quaternary Encoding 2B1Q Encoding 2 Binary 1 Quaternary Encoding 4 Voltages 66 MLT-3 Encoding (Bipolar) 67 MLT-3 Encoding MLT-3 Encoding Similar to NRZ-I Uses 3 Levels Of Signal +1, 0, -1 The Signal Transitions From One Level To The Next At The Beginning Of A 1 Bit There Is No Transition At The Beginning Of A 0 Bit 68 Block Encoding 69 Figure 4.15 Block coding Need Some Kind Of Redundancy To Assure Synchronization! High Performance! Need Some Of The Chapter 10 Error Detection To Assure Delivery! 70 Block Encoding 1. Divide Into Groups Of M Bits 2. Substitute N-Bit Code For M-Bit Group N>M 3. Use A Line Encoding Scheme To Create A Signal Comes At A Cost - Requires Increase Bandwidth! 71 Figure 4.16 Substitution in block coding 72 4B5B 8B10B Encoding 73 Table 4.1 4B/5B encoding -- Not All 5 Bit Codes Used! Data Code Data Code 0000 11110 1000 10010 0001 01001 1001 10011 0010 10100 1010 10110 0011 10101 1011 10111 0100 01010 1100 11010 0101 01011 1101 11011 0110 01110 1110 11100 0111 01111 1111 11101 74 Table 4.1 4B/5B encoding (Continued) Data Code Q (Quiet) 00000 I (Idle) 11111 H (Halt) 00100 J (start delimiter) 11000 K (start delimiter) 10001 T (end delimiter) 01101 S (Set) R (Reset) 11001 00111 8B/10B Encoding Groups of 8 Bits - Substituted Into A 10 Bit Code - More Efficient & Better Error Detection! Long Table! 75 8B6T Encoding 76 8B/6T Block Encoding Take Advantage Of Speed & Error Detection Of Block Encoding Requires Much Less Bandwidth 8 Binary Bits Substituted Into A 6 Bit Ternary Table 8 Bits Translated Into 6 Bit of +1, 0, -1 [Table In Appendix D] 28 8-Bit Sequences <== Translated Into ==> 36 Ternary 256 729 77 Analog To Digital Encoding 78 Encoding Methods Review Digital-ToDigital Analog-ToDigital Digital-ToAnalog Analog-ToAnalog Binary Data Must Be Encoded/Converted To A Form That Will Propagate Over A Wire 79 Analog To Digital Encoding Analog To Digital Encoding – Digitizing An Analog Signal Reducing The Potentially Infinite Number Of Values In An Analog Signal So That They Can Be Represented In A Digital Stream With A Minimum Loss Of Information. 80 Codec PAM PCM 81 Codec – Coder-Decoder Analog To Digital Converter Called A Codec coder –decoder codec Conversion Requires Two Steps: Pulse Amplitude Modulation (PAM) Pulse Code Modulation (PCM) 82 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. 83 Step 1: Pulse Amplitude Modulation (PAM) I. Pulse Amplitude Modulation (PAM) Sample Analog Signal At Regular Intervals Generate Pulses Accuracy Depends Upon # Of Samples Selected 84 Step 2: Pulse Code Modulation (PCM)- 1 II. Pulse Code Modulation (PCM) 3 Steps Step 1: Quantitize PAM Signals 85 Step 2: Pulse Code Modulation (PCM) - 2 II. Pulse Code Modulation (PCM) 3 Steps Step 2: Translate Each Value Into 7 Bit Binary Equivalent 86 Step 2: Pulse Code Modulation (PCM) - 3 II. Pulse Code Modulation (PCM) 3 Steps Step 3: Convert To Digital Using Appropriate Technique. Review Unipolar Polar … Bipolar … 87 Complete Analog-To-Digital Conversion Flow Diagram 88 Nyquist According to the Nyquist Theorem, the Sampling Rate must be at least 2 times the Highest Frequency. 89 NYQUIST Theorem Sampling Rate Remember : Analog-To-Digital Accuracy Depends Upon # Of Samples Selected How Many? Nyquist Theorem : The Sampling Rate Must Be At Least Two Times The Highest Frequency! 90 Nyquist In The Real World Sampling Rate Practice Telephone Voice Maximum Frequency = 4000 Hz 8,000 Samples/Second Sampling Rate = __________ A Bandwidth of 11,000 Is Needed To Transfer A Signal Whose Frequency Range Is 1,000 Hz to 12,000 Hz. 24,000 Samples/Second Sampling Rate = __________ 91 Bit Rate Bit Rate = Sampling Rate x Number Bits Per Sample Bit Rate : Also Called The Data Rate 92 Bit Rate Practice Want To Digitize Human Voice Using Eight Bit Samples. Human Voice Has Frequency Range of 0 to 4 KHz. Sampling Rate = 2 * Highest Frequency (4000 Hz) 8,000 Samples/Second Sampling Rate = __________ Bit Rate = Sampling Rate (8,000) * NoBitsPerSample (8) Bit Rate = 64,000 bps 64 Bit Rate = __________ Kbps 93 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 94 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. 95 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 96 Transmission Modes 97 Data Transmission Parallel Serial Synchronous Asynchronous 98 Parallel Transmission Parallel Transmission – Eight or More Lines Are Bundled Together To Send One Byte At A Time 99 Serial Transmission Serial Transmission – Requires Only One Communication Channel 100 Serial or Parallel Transmission Which Is Faster? 101 Serial or Parallel Transmission Which Is Least Expensive? Usually Limited To Short Distances 102 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. 103 Serial Transmission Asynchronous - 1 Asynchronous – Information Sent & Received In Agreed Upon Patterns; Timing Is Unimportant! 104 Serial Transmission Asynchronous - 2 Asynchronous Serial Transmission Start Bit [0] Is Sent To Alert Receiver 8 Bits – 1 Byte – Of Data Transmitted 1-2 Stop Bits [1’s] Is/Are Sent To Let User Know Finished A Brief Time Gap Often Follows Some Type Of Synchronization Must Be Embedded Within Data Cheap/Effective Choice For Low Speed Communication [Great For Terminal – Computer!] 105 Asynchronous here means “asynchronous at the byte level,” but the bits are still synchronized; their durations are the same. 106 Serial Transmission Synchronous - 1 Synchronous – Information Combined Into Frames [Multiple Bytes]; Timing Is Essential! 107 Serial Transmission Synchronous - 2 Synchronous Serial Transmission No Gaps – Unbroken String 1’s & 0’s Gaps Generally Filled In With Agreed Upon Sequences Of 1’s & 0’s – Idle Timing Essential Much Faster Than Asynchronous 108 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. 109 Good Practice Problem Sketch The Encoding Of Signal 11000011 With Each Of The Following On A New Page. Write NothingElse On This/These Pages Except Encoding Type & Your Name(s). Each Person On Team Must Do Their Own Copy Of This Problem! A. Unipolar B. NRZ-L C. NRZ-I D. RZ E. Manchester F. Differential Manchester G. AMI H. Pseudoternary I. B8ZS J. Quaternary 2B1Q K. MLT-3 L. 4B5B 110 M. 8B6T Data Communications & Networking CSCI 3342 Dr. Thomas E. Hicks Computer Science Department Trinity University Textbook: Computer Networks By Andrew Tanenbaum Textbook: Data Communications & Networking By Behrouz Forouzan Special Thanks To WCB/McGraw-Hill For Providing Graphics For Many Text Book Figures For Use In This Presentation. 111