MAT 105 Spring 2008 Chapter 17: Binary Codes.

Slides:



Advertisements
Similar presentations
Even/odd parity (1) Computers can sometimes make errors when they transmit data. Even/odd parity: is basic method for detecting if an odd number of bits.
Advertisements

MAT 105 Spring  A binary code is a system for encoding data made up of 0’s and 1’s  Examples  Postnet (tall = 1, short = 0)  UPC (dark = 1,
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Computer Science 101 Data Encryption And Computer Networks.
Math for Liberal Studies.  Problems can occur when data is transmitted from one place to another  The two main problems are  transmission errors: the.
Math for Liberal Studies.  Many of the ID numbers we have studied need to be represented in a way that is readable by machines  While computers can.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
MAT 1000 Mathematics in Today's World Winter 2015.
Unit 1 Protocols Learning Objectives: Understand the need to detect and correct errors in data transmission.
Error Detection and Correction
The Mathematics of Star Trek Data Transmission Michael A. Karls Ball State University.
MAT 105 Spring  We’re probably most familiar with seeing bar codes on the products we buy in the grocery store  However, machine-readable codes.
MAT 1000 Mathematics in Today's World Winter 2015.
Chapter 17: Information Science Lesson Plan Binary Codes Encoding with Parity-Check Sums Cryptography Web Searches and Mathematical Logic 1 Mathematical.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Chapter P Prerequisites: Fundamental Concepts of Algebra
The Mathematics of Star Trek
Chapters 16 & 17 Sarah Cameron 18 March  Review of Modular Arithmetic  Identification Numbers ZIP Codes Bar Codes  Binary Codes  Encryption.
Information Coding in noisy channel error protection:-- improve tolerance of errors error detection: --- indicate occurrence of errors. Source.
PART III DATA LINK LAYER. Position of the Data-Link Layer.
Math for Liberal Studies.  A binary code is a system for encoding data made up of 0’s and 1’s  Examples  Postnet (tall = 1, short = 0)  UPC (dark.
Error Control Code. Widely used in many areas, like communications, DVD, data storage… In communications, because of noise, you can never be sure that.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Data and Computer Communications by William Stallings Eighth Edition Digital Data Communications Techniques Digital Data Communications Techniques Click.
Practical Session 10 Error Detecting and Correcting Codes.
AS Computing Data Transmission and Networks. Transmission error Detecting errors in data transmission is very important for data integrity. There are.
CRYPTOGRAPHY. WHAT IS PUBLIC-KEY ENCRYPTION? Encryption is the key to information security The main idea- by using only public information, a sender can.
Computer Communication & Networks Lecture 9 Datalink Layer: Error Detection Waleed Ejaz
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 PART III: DATA LINK LAYER ERROR DETECTION AND CORRECTION 7.1 Chapter 10.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Unit 1 Digital Data Section D. Chapter 1, Slide 2Starting Out with Visual Basic 3 rd EditionIntroduction to ComputersUnit 1D – Digital DataSlide 2 Wikipedia.
Hamming Codes The Hamming Code is a Forward Error-correcting Code (FEC) that uses redundant bits to correct a single bit error For 4 bit codes, 3 redundant.
Dr. Clincy Professor of CS
2.8 Error Detection and Correction
The Art of Computational Thinking…Binary Code
The Mathematics of Star Trek Workshop
Error Detection & Correction
AP CSP: Sending Binary Messages with the Internet Simulator
Dr. Clincy Professor of CS
Computer Architecture and Assembly Language
Data Link Layer.
Cyclic Redundancy Check (CRC)
Introduction to Computers
Error Correcting Code.
15-853:Algorithms in the Real World
Error Detection and Correction
Even/odd parity (1) Computers can sometimes make errors when they transmit data. Even/odd parity: is basic method for detecting if an odd number of bits.
Part III Datalink Layer 10.
Dhanushiya. R I YEAR BSc COMPUTER TECHNOLOGY.  Error is a condition when the output information does not match with the input information. During transmission,
Packetizing Error Detection
MAT 105 Fall 2008 Bar Codes.
Packetizing Error Detection
Probability And Expected Value ————————————
Fundamentals of Data Representation
Packetizing Error Detection
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Probability And Expected Value ————————————
Chapter 16: Check Digit Systems, Continued
CS 325: CS Hardware and Software Organization and Architecture
Communicating Efficiently
Error Detection and Correction
Computer Architecture and Assembly Language
Reliability and Channel Coding
Types of Errors Data transmission suffers unpredictable changes because of interference The interference can change the shape of the signal Single-bit.
Error Detection and Correction
2.8 Error Detection and Correction
Chapter 17: Information Science Lesson Plan
Data Link Layer. Position of the data-link layer.
Presentation transcript:

MAT 105 Spring 2008 Chapter 17: Binary Codes

Binary Codes A binary code is a system for encoding data made up of 0’s and 1’s Examples Postnet (tall = 1, short = 0) UPC (dark = 1, light = 0) Morse code (dash = 1, dot = 0) Braille (raised bump = 1, flat surface = 0) Movie ratings (thumbs up = 1, thumbs down = 0)

Binary Codes are Everywhere CD, MP3, and DVD players, digital TV, cell phones, the Internet, space probes, etc. all represent data as strings of 0’s and 1’s rather than digits 0-9 and letters A-Z Whenever information needs to be digitally transmitted from one location to another, a binary code is used

Transmission Problems What are some problems that can occur when data is transmitted from one place to another? The two main problems are transmission errors: the message sent is not the same as the message received security: someone other than the intended recipient receives the message

Transmission Error Example Suppose you were looking at a newspaper ad for a job, and you see the sentence “must have bive years experience” We detect the error since we know that “bive” is not a word Can we correct the error? Why is “five” a more likely correction than “three”? Why is “five” a more likely correction than “nine”?

Another Example Suppose NASA is directing one of the Mars rovers by telling it which crater to investigate There are 16 possible signals that NASA could send, and each signal represents a different command NASA uses a 4-digit binary code to represent this information 0000 0100 1000 1100 0001 0101 1001 1101 0010 0110 1010 1110 0011 0111 1011 1111

Lost in Transmission The problem with this method is that if there is a single digit error, there is no way that the rover could detect or correct the error If the message sent was “0100” but the rover receives “1100”, the rover will never know a mistake has occurred This kind of error – called “noise” – occurs all the time

Adding Check Digits One way to try to avoid these errors is to send the same message twice This would allow the rover to detect the error, but not correct it (since it has no way of knowing if the error occurs in the first copy of the message or the second) There is a better way to allow the rover to detect and correct these errors, and only requires 3 additional digits

Computing the Check Digits The original message is four digits long We will call these digits I, II, III, and IV We will add three new digits, V, VI, and VII Draw three intersecting circles as shown here Digits V, VI, and VII should be chosen so that each circle contains an even number of ones V I VI III IV II VII

Appending Digits to the Message The message we want to send is “0100” Digit V should be 1 so that the first circle has two ones Digit VI should be 0 so that the second circle has zero ones (zero is even!) Digit VII should be 1 so that the last circle has two ones Our message is now 0100101 1 1 1

Detecting and Correcting Errors Now watch what happens when there is a single digit error We transmit the message 0100101 and the rover receives 0101101 The rover can tell that the second and third circles have odd numbers of ones, but the first circle is correct So the error must be in the digit that is in the second and third circles, but not the first: that’s digit IV Since we know digit IV is wrong, there is only one way to fix it: change it from 1 to 0 1 1 1 1

Try It! Encode the message 1110 using this method You have received the message 0011101. Find and correct the error in this message.

Extending This Idea This method only allows us to encode 16 possible messages, which isn’t even enough to represent the alphabet! However, if we use more digits, we won’t be able to use the circle method to detect and correct errors We’ll have to come up with a different method that allows for more digits

Parity Check Sums The circle method is a specific example of a “parity check sum” The “parity” of a number is 1 is the number is odd and 0 if the number is even For example, digit V is 0 if I + II + III is even, and 1 if I + II + III is odd

Conventional Notation Instead of using Roman numerals, we’ll use a1 to represent the first digit of the message, a2 to represent the second digit, and so on We’ll use c1 to represent the first check digit, c2 to represent the second, etc.

Old Rules in the New Notation Using this notation, our rules for our check digits become c1 = 0 if a1 + a2 + a3 is even c1 = 1 if a1 + a2 + a3 is odd c2 = 0 if a1 + a3 + a4 is even c2 = 1 if a1 + a3 + a4 is odd c3 = 0 if a2 + a3 + a4 is even c3 = 1 if a2 + a3 + a4 is odd c1 a1 c2 a3 a4 a2 c3

An Alternative System If we want to have a system that has enough code words for the entire alphabet, we need to have 5 message digits: a1, a2, a3, a4, a5 This gives us 32 possible messages… enough for the alphabet and then some We will also need more check digits to help us decode our message: c1, c2, c3, c4

Rules for the New System We can’t use the circles to determine the check digits for our new system (if we tried to draw 5 circles, things would get very hard), so we use the parity notation from before c1 is the parity of a1 + a2 + a3 + a4 c2 is the parity of a2 + a3 + a4 + a5 c3 is the parity of a1 + a2 + a4 + a5 c4 is the parity of a1 + a2 + a3 + a5

An Example Code Word What check digits do we have to add on to the message “00101”? This message will represent the letter “F” c1 is the parity of a1 + a2 + a3 + a4 = 1, which is 1 c2 is the parity of a2 + a3 + a4 + a5 = 2, which is 0 c3 is the parity of a1 + a2 + a4 + a5 = 1, which is 1 c4 is the parity of a1 + a2 + a3 + a5 = 2, which is 0 So the code word will be 001011010

Making the Code Using 5 digits in our message gives us 32 possible messages, we’ll use the first 26 to represent letters of the alphabet On the next slide you’ll see the code itself, each letter together with the 9 digit code representing it

The Code Letter Code A 000000000 N 011010101 B 000010111 O 011101100 C 000101110 P 011111011 D 000111001 Q 100001011 E 001001101 R 100011100 F 001011010 S 100100101 G 001100011 T 100110010 H 001110100 U 101000110 I 010001111 V 101010001 J 010011000 W 101101000 K 010100001 X 101111111 L 010110110 Y 110000100 M 011000010 Z 110010011

Using the Code Now that we have our code, using it is simple When we receive a message, we simply look it up on the table But what happens when the message we receive isn’t on the list? Then we know an error has occurred, but how do we fix it? We can’t use the circle method anymore

Beyond Circles Using this new system, how do we decode messages? Simply compare the (incorrect) message with the list of possible correct messages and pick the “closest” one What should “closest” mean? The distance between the two messages is the number of digits in which they differ

The Distance Between Messages What is the distance between 110010110 and 101010110? The messages differ in the 2nd and 3rd digits, so the distance is 2 What is the distance between 1110010 and 0001100? The messages differ in all but the 7th digit, so the distance is 6

Nearest-Neighbor Decoding The nearest neighbor decoding method decodes a received message as the code word that agrees with the message in the most positions Another way to think of it is that the “nearest neighbor” is the message that is the smallest distance away from the message we receive

Trying it Out Suppose that, using our alphabet code, we receive the message 010100011 We can check and see that this message is not on our list How far away is it from the messages on our list?

Distances From 010100011 Code Distance 000000000 4 011010101 5 000010111 011101100 000101110 011111011 3 000111001 100001011 001001101 6 100011100 8 001011010 100100101 001100011 2 100110010 001110100 101000110 010001111 101010001 010011000 101101000 010100001 1 101111111 010110110 110000100 011000010 110010011

Fixing the Error Since 010100001 was closest to the message that we received, we know that this is the most likely actual transmission We can look this corrected message up in our table and see that the transmitted message was (probably) “K” This might still be incorrect, but other errors can be corrected using context clues or check digits