Gandhinagar Institute of Technology
MCWC ALA
Topic: Error Correction and Error Detection
Prepared By:
Tarj Mehta (170120107074)
Guided By: Prof. Parita Shah
Introduction
• For reliable communication, errors must be detected and corrected.
• The data may get corrupted during transmission.
• The data link layer uses some error control mechanism to ensure that
frames (stream of data bits) are transmitted with accuracy.
• In OSI model, error detection and correction are implemented either
at data link layer or transport layer.
TypesofError
Single bit
Multiple bit
Burst
Error Detection
• It uses concept of redundancy, means adding extra bits for detecting
errors at receiving-end.
• There are 3 methods:
1. Parity Check
2. Cyclic redundancy check
3. Checksum
Parity Check
• An extra bit is added at the end of data and number of 1’s remain
even.
• If block has even number of 1’s, 0 is added at the end.
• If block has odd number of 1’s, 1 is added at the end.
• On the receiver side parity bit is computed and check with received
data.
• Sender:
Data: 1 1 0 1 0 0
As it has odd number of 1’s, 1 will be added
With parity: 1 1 0 1 0 0 1
• This will be transmitted via transmitting media.
• Receiver:
Parity bit will be computed.
If parity bit are correct (1 1 0 1 0 0 1) then only data will be accepted
otherwise it will be rejected.
• Disadvantage: Error in more than one bit cannot be detected.
Cyclic Redundancy check
• In this method parity bits are calculated for each row and column and
are sent along with data to the receiver.
• At receiving end these are compared with the parity bits calculated
on the received data.
• Suppose, the given data: 1101101 and divisor: 10101
• Append 4 zeros at the end of data (divisor – 1)
• Division is done by X – OR.
_1110111______
10101 | 11011010000
| 10101
011100
10101
010011
10101
001100
00000
011000
10101
011010 The remainder is not 0, so there is some
10101 error. Now, Append the remainder to data
011110
10101
01011
1110111______
10101| 11011011011
| 10101
011100
10101
010011
10101
001101
00000
011010
10101
011111 As the remainder is 0, the received data is error free
10101
010101
10101
00000
Checksum
• The given data is divided into data segments of k size.
• Each segment is added using 1’s complement method and at the end
they are complemented and the check sum is sent along with data
segments.
• At the receiving end all the segments are added with checksum.
• If the answer is 0, the data is accepted.
• If there is any tampering with the bits, the answer will not be 0 and
error can be detected.
Example
• Question: 10110011 10101011 01011010 11010101
10110011
10101011
1| 01011110
1
01011111
01011010
10111001
11010101
1| 10001111
1
10001111 Now 1’s complement is: 0111000 (checksum)
• Performing the addition again with check sum block…
10110011
10101011
1| 01011110
1
01011111
01011010
10111001
11010101
1| 10001110
1
10001111
01110000
11111111
Complementing this we get 00000000, hence data will be accepted.
Error correction
• It has 1 technique:
1. Hamming code
Hamming Code
• It is a set of error correction codes that can be used to detect and
correct the errors encountered during transmission.
• It has various steps to detect and correct the error.
• Example: A 7bit hamming code is received as 1011011. Assume even
parity and state whether the received code is correct or wrong, if
wrong locate the bit in error.
• Solution: Received Hamming code is
• Step1: Detecting error
Analyzing bits P1 D3 D5 D7 (skip one take one)
1 0 1 1 = odd parity = error exists
Now, keeping P1=1
Step2: Analyzing bits P2 D3 D6 D7
1 0 0 1 = even 1’s = no error
D7 D6 D5 P4 D3 P2 P1
1 0 1 1 0 1 1
• Step3: Analyzing bits P4 D5 D6 D7
1 1 0 1 = odd 1’s = error exists
Keeping P4=1
Here, P4 and P1 are not equal to zero.
Correcting Error: E =
Decimal value for 101 is 5, which shows that 5th bit is error bit.
So, we write correct word by simply inverting 5th bit.
Final answer: 1001011
P4 P2 P1
1 0 1
References
• https://www.youtube.com/watch?v=nUwGf5ZgqsA
• https://www.youtube.com/watch?v=nix346H-RN8
Thank YOU.

Error detection and Correction

  • 1.
    Gandhinagar Institute ofTechnology MCWC ALA Topic: Error Correction and Error Detection Prepared By: Tarj Mehta (170120107074) Guided By: Prof. Parita Shah
  • 2.
    Introduction • For reliablecommunication, errors must be detected and corrected. • The data may get corrupted during transmission. • The data link layer uses some error control mechanism to ensure that frames (stream of data bits) are transmitted with accuracy. • In OSI model, error detection and correction are implemented either at data link layer or transport layer.
  • 3.
  • 4.
    Error Detection • Ituses concept of redundancy, means adding extra bits for detecting errors at receiving-end. • There are 3 methods: 1. Parity Check 2. Cyclic redundancy check 3. Checksum
  • 5.
    Parity Check • Anextra bit is added at the end of data and number of 1’s remain even. • If block has even number of 1’s, 0 is added at the end. • If block has odd number of 1’s, 1 is added at the end. • On the receiver side parity bit is computed and check with received data.
  • 6.
    • Sender: Data: 11 0 1 0 0 As it has odd number of 1’s, 1 will be added With parity: 1 1 0 1 0 0 1 • This will be transmitted via transmitting media. • Receiver: Parity bit will be computed. If parity bit are correct (1 1 0 1 0 0 1) then only data will be accepted otherwise it will be rejected. • Disadvantage: Error in more than one bit cannot be detected.
  • 7.
    Cyclic Redundancy check •In this method parity bits are calculated for each row and column and are sent along with data to the receiver. • At receiving end these are compared with the parity bits calculated on the received data. • Suppose, the given data: 1101101 and divisor: 10101 • Append 4 zeros at the end of data (divisor – 1) • Division is done by X – OR.
  • 8.
    _1110111______ 10101 | 11011010000 |10101 011100 10101 010011 10101 001100 00000 011000 10101 011010 The remainder is not 0, so there is some 10101 error. Now, Append the remainder to data 011110 10101 01011
  • 9.
    1110111______ 10101| 11011011011 | 10101 011100 10101 010011 10101 001101 00000 011010 10101 011111As the remainder is 0, the received data is error free 10101 010101 10101 00000
  • 10.
    Checksum • The givendata is divided into data segments of k size. • Each segment is added using 1’s complement method and at the end they are complemented and the check sum is sent along with data segments. • At the receiving end all the segments are added with checksum. • If the answer is 0, the data is accepted. • If there is any tampering with the bits, the answer will not be 0 and error can be detected.
  • 11.
    Example • Question: 1011001110101011 01011010 11010101 10110011 10101011 1| 01011110 1 01011111 01011010 10111001 11010101 1| 10001111 1 10001111 Now 1’s complement is: 0111000 (checksum)
  • 12.
    • Performing theaddition again with check sum block… 10110011 10101011 1| 01011110 1 01011111 01011010 10111001 11010101 1| 10001110 1 10001111 01110000 11111111 Complementing this we get 00000000, hence data will be accepted.
  • 13.
    Error correction • Ithas 1 technique: 1. Hamming code
  • 14.
    Hamming Code • Itis a set of error correction codes that can be used to detect and correct the errors encountered during transmission. • It has various steps to detect and correct the error. • Example: A 7bit hamming code is received as 1011011. Assume even parity and state whether the received code is correct or wrong, if wrong locate the bit in error.
  • 15.
    • Solution: ReceivedHamming code is • Step1: Detecting error Analyzing bits P1 D3 D5 D7 (skip one take one) 1 0 1 1 = odd parity = error exists Now, keeping P1=1 Step2: Analyzing bits P2 D3 D6 D7 1 0 0 1 = even 1’s = no error D7 D6 D5 P4 D3 P2 P1 1 0 1 1 0 1 1
  • 16.
    • Step3: Analyzingbits P4 D5 D6 D7 1 1 0 1 = odd 1’s = error exists Keeping P4=1 Here, P4 and P1 are not equal to zero. Correcting Error: E = Decimal value for 101 is 5, which shows that 5th bit is error bit. So, we write correct word by simply inverting 5th bit. Final answer: 1001011 P4 P2 P1 1 0 1
  • 17.
  • 18.