0% found this document useful (0 votes)
23 views

Theme 3 Error Detection and Correction

The document discusses various techniques for error detection and correction in data transmission, including: 1. Parity checks involve adding an extra bit to make the total number of 1s in a data unit either even or odd for error detection. Two-dimensional parity can detect all single bit errors and correct none, while one-dimensional parity can only detect errors. 2. Checksums involve dividing data into segments, XORing the segments, and sending the complemented sum for error detection. 3. Cyclic redundancy checks (CRCs) use binary division of data and a predetermined generator value for even stronger error detection than checksums. 4. Hamming codes are error-correcting codes that can detect

Uploaded by

Cindy Mabangula
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Theme 3 Error Detection and Correction

The document discusses various techniques for error detection and correction in data transmission, including: 1. Parity checks involve adding an extra bit to make the total number of 1s in a data unit either even or odd for error detection. Two-dimensional parity can detect all single bit errors and correct none, while one-dimensional parity can only detect errors. 2. Checksums involve dividing data into segments, XORing the segments, and sending the complemented sum for error detection. 3. Cyclic redundancy checks (CRCs) use binary division of data and a predetermined generator value for even stronger error detection than checksums. 4. Hamming codes are error-correcting codes that can detect

Uploaded by

Cindy Mabangula
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Theme 3: Error detection

and correction
Objectives
• Overview
• Parity check
• Check sum
• CRC (Cyclic Redundancy Check)
• Hamming codes
Overview
• A WAN is said to operate at the physical layer and at the data link
layer.
• characteristics that separate a WAN from a LAN are typically found at the
physical layer and the data link layer
• But routing occurs at layer 3?
• If a WAN operate at layer 1 and 2, is a router LAN or WAN device?
• Difference comes when a router uses the physical and data link layer
standards and protocols that are associated with WANs
• The primary WAN roles of a router are therefore not routing, but
providing connections to and between the various WAN physical and
data-link standards
Error detection and correction
• It is a link-layer service.
• Where is link layer implemented?
• Sending side
• Encapsulate datagram from higher layers in a link-layer frame
• Receiving side
• Receives the entire frame and de-capsulates the network layer datagram
• Sending controller sets the error detection
Parity Check – 1-dimensional
• Parity checking can be one-dimensional or two dimensional
• In a single parity-check, an extra bit is added to every data unit
• The objective of adding the parity bit (a 0 or a 1) is to make the total
number of 1s in the data unit (including the parity bit) to become
even.
• Some systems may use odd-parity checking, where the total number
of 1s should then be odd.
• Even parity is typically used for synchronous transmission and odd
parity for asynchronous transmission.
Parity Check – 1-dimensional
• The MSB of an 8-bits word is used as the parity bit and the remaining
7 bits are used as data or message bits.
Parity Check – 1-dimensional
• The parity bit can be set to 0 and 1 depending on the type of the parity required.
• For even parity, this bit is set to 1 or 0 such that the no. of "1 bits" in the entire word is even. Shown in
fig. (a).
• For odd parity, this bit is set to 1 or 0 such that the no. of "1 bits" in the entire word is odd. Shown in
fig. (b).
Parity Check – 1-dimensional
• Example
• The data 1010100 is given the even parity bit of 1, resulting in the bit sequence 10101001.
• This data is transferred to another computer. In transit, the data is corrupted, and the
computer receives the incorrect data 10000101. (but computer does not know it)
• The receiving computer computes the parity: 1+0+0+0+0+1+0+1 = 3.
• It then performs 3 modulo 2 (the remainder of 3 divided by 2), expecting the result 0 which
would indicate that the number is even.
• Instead, it receives the result 3 modulo 2 = 1, indicating that the number is odd.
• Because it is looking for numbers with even parity, it asks the original computer to send the
data again.
• This time, the data comes through with no errors: 10101001. The receiving computer
calculates 1+0+1+0+1+0+0+1 = 4.
• 4 modulo 2 = 0, indicating even parity.
• The parity bit is stripped from the end of the sequence, and the data 1010100 is accepted.
Parity check – 2 dimensional
• Generalization of the one-dimensional parity scheme.
• Form an MxN matrix of bits, then
• Add a (even or odd) parity bit to each row and to each column
• Example:
• Transmitted data (unprotected): 1111000 1010101 1111111
• Two dimensional (even) parity:

11110000
10101010
11111111
10100101
Parity check – 2 dimensional
• Received one bit in error:
11110000
10101010
11011111 odd parity (should be even)
10100101

odd parity (should be even)


Parity check – 2 dimensional
• Why use: Two-dimensional parity scheme can correct all 1 bit errors
• In the example, the receiver can take the initiative and correct
(change) the received message
Parity check – 2 dimensional
• Two-dimensional parity scheme can detect all 2
bit errors but cannot correct the transmitted
data:
• Received two bits in error:
• Original
11110000
10111010 odd parity
11011111 odd parity
10100101

odd parity
Checksum

• In checksum error detection scheme, the data is divided into k segments


each of m bits.
• In the sender’s end
• the segments are XOR added in pair to get the sum.
• The sum is complemented to get the checksum.
• The checksum segment is sent along with the data segments.
• At the receiver’s end,
• all received segments are added using 1’s complement arithmetic to get the sum.
• The sum is complemented.
• If the result is zero, the received data is accepted; otherwise discarded.
Checksum
• Example
Cyclic Redundancy Check (CRC)
• Even stronger protection
• Unlike checksum scheme, which is based on addition, CRC is based on binary division.

• In CRC, at source:
– a sequence of redundant bits, called CRC check bits, are appended to the end of data unit so that the
resulting data unit becomes exactly divisible by a second, predetermined binary number.
– The predetermined binary number is called a generator value

• At the destination:
– the incoming data unit is divided by the generator value.
– If at this step there is no remainder, the data unit is assumed to be correct and is therefore accepted.
– A remainder indicates that the data unit has been damaged in transit and therefore must be rejected.
Cyclic Redundancy
Check (CRC)
• Example
Hamming Code
• Error correcting code
• A block code that is capable of;
• detecting up to two simultaneous bit errors, and
• correcting single-bit errors
• The source encodes the message by inserting redundant bits within the
message.
• The redundant bits are the extra bits that are generated and inserted at
specific positions in the message itself to enable error detection and
correction.
• When the destination receives this message, it performs recalculations to
detect errors and find the bit position that has error.
Hamming Code
• The number of redundant bits can be calculated using the following
formula:
• 2^r ≥ m + r + 1
• where, r = redundant bit, m = data bit
• Put check bits in positions p that are powers of 2, starting with
position 1
• Check bit in position p is parity of data bits in positions with a p term
in their values
• Plus an easy way to correct [soon]
Hamming Code
• Example: data=0101, 3 check bits
– 7 bit code, check bit positions 1, 2, 4
– Check 1 covers positions 1, 3, 5, 7
– Check 2 covers positions 2, 3, 6, 7
– Check 4 covers positions 4, 5, 6, 7

1 2 3 4 5 6 7
Hamming Code
• Example: data=0101, 3 check bits
– 7 bit code, check bit positions 1, 2, 4
– Check 1 covers positions 1, 3, 5, 7
– Check 2 covers positions 2, 3, 6, 7
– Check 4 covers positions 4, 5, 6, 7

0 1 0 0 1 0 1
1 2 3 4 5 6 7

p1= 0+1+1 = 0, p2= 0+0+1 = 1, p4= 1+0+1 = 0


Hamming Code
• To decode:
– Re-compute check bits (with parity sum including the check bit)
– Arrange as a binary number
– Value (syndrome) tells error position
• The set of check results form the error syndrome and is used to pinpoint and correct the
error
– Value of zero means no error
– Otherwise, flip bit to correct
Hamming Code
• Receiver end

0 1 0 0 1 0 1
1 2 3 4 5 6 7

p1= 0+0+1+1 = 0, p2= 1+0+0+1 = 0, p4= 0+1+0+1 = 0


Syndrome = 000, no error
Data = 0 1 0 1
Classwork
• Compute Hamming Code for data bits: 1011011001

You might also like