Error Detection and Correction

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 38

Error Detection and Correction

Background Information
01000110 01000010

• Suppose that the data bits 01000110 are transmitted and


received as 01000010. Would the received bits represent
the same transmitted character?
• Errors can occur during signal transmission as illustrated in
the figure above. They can be caused by
– Carrier wave problems like electrical faults
– Hardware malfunctions like logic gate faults
– Software errors also called bugs
– Signal impairment like power surges and noise
The transmitter and receiver then should have a mechanism of
detecting and correcting such kind of errors
Topics
• Causes of Errors
• Types of Errors
• Error Detection Methods
– Parity Check
– CRC
– Block CheckSum
• Error Correction Methods
– Data retransmission (manual correction)
– Hamming code (automatic error correction)
Single-bit error

• Single bit errors are errors in which only


one bit is altered
• It takes a relatively shorter time to
detect it
• Therefore most applicable in parallel
transmission
Burst error
Burst error is where two or more bits in the data unit are altered
e.g from 1 to 0 or from 0 to 1.

Burst errors does not necessarily mean that the errors occur
in consecutive bits, the length of the burst is measured from
the first corrupted bit to the last corrupted bit. Some bits in
between may not have been corrupted.
Burst error
• Burst error is most likely to happen in serial transmission
since the duration of the error cause is normally longer
than the duration of a bit.
• The number of bits affected depends on the data rate and
duration of error cause.
Error detection
• Error detection is the decision on whether the received
data is correct or not without having a copy of the original
message.
• Error detection uses the concept of redundancy, which
means adding extra bits for detecting errors at the
destination.
Redundancy
Data bits
1001101010000001

Accept
Extra bits Error
Generator checking
Reject
1001
Redundancy check

Sender Receiver

1001 1001101010000001
Data + redundancy bits=codeword
Three types of redundancy checks are used
in data communications
Parity or Vertical Redundancy Check
(VRC)
• Parity check is the process of adding one extra bit to a
character bits for error checking and correction.
• The extra bit (called the parity bit), is selected to make the total
number of 1s in the codeword is even or odd.
• Even parity (ensures that a codeword has an even number of
1’s) and odd parity (ensures that there are an odd number of
1’s in the codeword)
Example: even parity Example: odd parity
1000000 → 11000000 1000000 → 01000000
1111101 → 01111101 1111101 → 11111101
1001001 → 11001001 1001001 → 01001001
Vertical Redundancy Check
VRC

• Parity check at the sender should match parity check at the


receiver
• If the parity check at the sender is even, then the receiver
check should equally be even for data to be accepted
Examples
Suppose you are using an odd parity. What should the
binary word “1010” look like after you add the parity bit?
Answer:
There is an even number of 1-bits.
So we need to add another 1-bit
Our new word will look like “11010”.
Suppose you are using an even parity. What should the
binary word “1010” look like after you add a parity bit?
Answer:
There is an even number of 1’s.
So we need to add another 0
Our new word will look like “01010”.
Suppose the sender wants to send the word world. In ASCII the five characters
are coded as
1110111 1101111 1110010 1101100 1100100
The following shows the actual bits sent
0 1110111 01101111 0 1110010 0 1101100 11100100
Now suppose the word world in the example is received by the receiver without
being corrupted in transmission.
01110111 01101111 01110010 01101100 11100100
The receiver counts the 1s in each character and comes up with even numbers
(6, 6, 4, 4, 4). The data are accepted.
Now suppose the word world in Example is corrupted during transmission.
0 1111111 0 1101111 01110110 01101100 11100100
The receiver counts the 1s in each character and comes up with even and odd
numbers (7, 6, 5, 4, 4). The receiver knows that the data are corrupted,
discards them, and asks for retransmission.
Now suppose the word world in Example 1 is corrupted during transmission.
01111111 01101111 01110110 01101100 11100100
The receiver counts the 1s in each character and comes up with even and odd
numbers (7, 6, 5, 4, 4). The receiver knows that the data are corrupted,
discards them, and asks for retransmission.
Performance
Consider the following data bits transmission and error
detection using parity checks
Sender Receiver Error check

01010110 01010100
(Even) (Odd) (Mismatch → error)

01010110 01010101
(Even) (Even) (match → no error) ??

• It can detect single bit error


• It can detect burst errors only if the total number
of errors is odd.
Longitudinal Redundancy Check (LRC)
To improve on the performance of VRC, LRC adds an extra
bit to a block of characters including the VRC itself
LRC
Direction of block transfer

0 1 1 1 1
1 0 0 0 1
0 0 0 1 1
Direction of unit transfer
1 1 1 1 0
0 0 1 1 0
1 1 1 0 1 VRC
0 0 0 1 1
1 1 0 1 1
LRC verifies the accuracy of stored and transmitted data using
parity bits. It is a redundancy check applied to a parallel group of
bit streams. The data to be transmitted is divided into
transmission blocks into which additional check data is inserted.

This term is also known as a horizontal redundancy check.


Difference between VRC and LRC
1. Vertical Redundancy Check (VRC) :
Vertical Redundancy Check is the error detection method which is used by upper
layers to detect error in data. The other name for VRC is Parity Check. A
redundant bit which is also named as parity bit is added to each data unit. This
method includes even parity and odd parity. When the total number of 1s in data is
even that there is even parity and when the total number of 1s in data is to be odd
that indicates there is odd parity in data.
2. Longitudinal Redundancy Check (LRC) :
Longitudinal Redundancy Check (LRC) is the error detection method which is used
by upper layers to detect error in data. The other name for VRC is 2-D parity
check. In this method, data which the user want to send is organized into tables of
rows and columns. To detect an error, a redundant bit is added to the whole block
after addition this block is transmitted to receiver side. This redundant bit is used by
receiver to detect error. If there is no error, receiver accepts the data and discards
the redundant row of bits.
S.No. Vertical Redundancy Check (VRC) Longitudinal Redundancy Check (LRC)

It stands for Vertical Redundancy


1. It stands for Longitudinal Redundancy Check.
Check.

In this redundant bit called parity bit In this redundant row of bits is added to the whole
2.
is added to each data unit. block.

3. VRC can detect single bit errors. LRC can detect burst errors.

4. It is also known as parity checker. It is also known as 2-D parity checker.

The advantage of using VRC is that it


can checks all single bit errors but The advantage of using LRC over VRC is that it can
5.
can check odd parity only in the case check all the burst errors.
of change of odd bits.

If two bits in data unit is damaged and also in other


It is not capable of checking the burst
data unit the same bits are damaged at same
6. error in case of change of bits is
position, then it is not capable of detecting such kind
even.
of error.
Cyclic Redundancy Check (CRC)
CRC is the addition of a number of extra bits to data bits
for error detection and correction.
The transmitter generates the extra bits known as a
frame check sequence (FCS), so that the resulting
frame, consisting of message bits, is exactly divisible by
some predetermined number.
The receiver then divides the incoming frame by the
same number and, if there is no remainder, assumes
that there was no error.
Mostly used in data communication
Tells us whether an error has occurred, but does not
correct the error.
This is a type of “systematic error detection”
The error-checking bits are appended to the information byte
Calculating and Using CRCs
1. Consider the data bits e.g 1001011
2. The sender and receiver agree on an
arbitrary bits e.g 1011.
3. Value one (1) is subtracted from the number
arbitrary bits and result equated to 0s binary
values. i.e 4-1=3(000). The 0s are put at the
end of data bits resulting to bit stream
1001011000.
4. Divide step 3 (dividend) by step 2(divisor)
using “modulo 2 division”.
CRC Division Rules
1. A number is divisible by binary 1 if the
number of binary numbers in the dividend
are equal to the number of binary numbers
of the divisor, otherwise it is divisible by 0 if
the number of bits in the dividend are less
2. 1-1=0, 1-0=1, 0-0=0, and 0-1=1
Division
1
1011 1001011000
Division starts by 1 for the
-1011
first four significant dividend
10 bits as in the divisor. Multiply
quotient and divisor and
subtract.
Division
10
1011 1001011000
-1011 Drop next binary 0 then divide
by 0 because the number of
100 dividend bits are less than the
-000 divisor bits

100
Division
101
1011 1001011000
-1011 Drop next binary 1 then divide
by 1 because the number of
100 dividend bits are equal to the
-000 divisor bits, multiply the binary 1
by divisor, then subtract
1001
-1011
10
Division
1010
1011 1001011000
-1011 Drop next binary 1 then divide
by 0 because the number of
100 dividend bits are less than the
-000 divisor bits. There is no need to
multiply by 0 (remainder remains
1001 the same) then subtract.
-1011
101
Division
10101
1011 1001011000
-1011 Drop next binary 0 then divide
by 1 because the number of
100 dividend bits are equal the
-000 divisor bits then multiply the 1
obtained by the divisor then
1001 subtract
-1011
1010
-1011
1
Division
1010100
1011 1001011000
-1011 Drop next binary 0 then divide
by 0 because the number of
100 dividend bits are less than the
-000 divisor bits, then drop 0 and
divide by 0. This brings the
1001 division to an end
-1011
1010
-1011
100
Division
After the division, the following parts of the operation
results
Divisor
1010100 Quotient

1011 1001011000 Dividend


-1011
100
-000
1001
-1011
1010
-1011
Remainder
100
Calculating and Using CRCs
5. After performing the division, the remainder is actually
the CRC
6. The remainder (CRC) is added to data bits to become
the transmissible message bits (codeword)
1001011 + 100 = 1001011100 = M
7. M is decoded and checked by the message receiver using
the reverse process. If the remainder are made of binary
0s (no remainder) then it indicates absence of errors,
otherwise if it some elements of binary bit 1, then it has
errors
suppose we use two options; 1. if the bits send are received
without alterations (no errors) and 2. if some bits are
altered (with errors)
1. Message without Errors
1010100
1011 1001011100
-1011
10 01
-1011
10 1 1
-1011
00
0
Therefore, R=000
The remainder has binary 0s therefore
indicates that no error occurred
2. Message with Errors
suppose the first two bits are altered
1001100
1011 0101011100
1011
1111
1011
1000
1011
110  Remainder
The remainder has some binary 1s therefore
indicates an error has occurred
Division in a CRC Transmitter
Division in the CRC Receiver for two cases
Block Checksum
Block checksum is also the addition of a number of extra bits
to data for error detection and correction. The extra bits are
called the checksum. Checksum is generated in blocks of
either 2, 4, 8, 16, 32, 64 etc bits (in terms of 2n)

The receiver follows these The sender follows these


steps: steps:
1. The unit is divided into k 1. The unit is divided into k
sections, each of n bits. sections, each of n bits.
2. All sections are added 2. All sections are added
using one’s complement using one’s complement to
to get the sum. get the sum.
3. The sum is 3. The sum is complemented
complemented. and becomes the
4. If the result is zero, the checksum.
data are accepted: 4. The checksum is sent with
otherwise, rejected the data.
Example
Suppose the following block of 16 bits is to be
sent using a checksum of 8 bits.
10101001 00111001
The numbers are added using one’s complement
11 1 1
10101001
+
11 100 01 0
00111001 Sum
00 011 10 1 Complement
(CheckSum)

Therefore, the bit stram sent is


10101001 00111001 00011101
Example
Now suppose the receiver receives the pattern
sent in Example 7 and there is no error.
10101001 00111001 00011101
When the receiver adds the three sections, it will
get all 1s, which, after complementing, is all 0s
and shows that there is no error.
10101001
00111001
00011101
Sum 11111111
Complement 00000000 means that the
pattern is OK.
Example
Now suppose there is a burst error of length 5 that
affects 4 bits.
10101111 11111001 00011101
When the receiver adds the three sections, it gets
10101111
11111001
00011101
Partial Sum 1 11000101
Carry 1
Sum 11000110
Complement 00111001 the pattern is corrupted.
Performance
• The checksum detects all errors involving an odd
number of bits.
• It detects most errors involving an even number
of bits.
• If one or more bits of a segment are damaged
and the corresponding bit or bits of opposite
value in a second segment are also damaged, the
sums of those columns will not change and the
receiver will not detect a problem.
Error Correction

It can be handled in two ways:


1) receiver can have the sender retransmit
the entire data unit.
2) The receiver can use an error-correcting
code, which automatically corrects certain
errors.
Assignment
1.Suppose the sender wants to send the word Cad!. In ASCII the five characters are
coded as 1000011 1100001 1100100 0100001. What is the actual bits transmitted if
it uses i. even parity check, ii. Odd parity check?
2.Suppose that a message making up 01100100 00100001 is send using checksum of 8
bits, i. What is the actual message bit stream transmitted?. ii. Suppose the bit stream
01100100 00100001 010101010 is received at the receiving end, is there any signal
error? Explain.
3.A sender that uses an encoding scheme that represents a character with three bits is
supposed to send a message making up the binary bit stream 101 011 001 using odd
parity and a checksum of 4 bits. (i)Determine the actual message bit stream
transmitted, (ii)Suppose the bit stream received at the receiving end is 1101 1011
0001 0101 there any signal error? Explain.
4. In CRC error detection, the data 00101101101 is encoded with 10101. i. What is
the actual data bits sent. Suppose the received data bit stream is 010111011001101,
is there any transmission error? Explain.

You might also like