Sei sulla pagina 1di 15

Error Detection and Correction Code Techniques

By

Deji Adebayo

1 July 2015

Abstract
I shall be discussing on various issues relating to data transmission of signal through different
transmission media. We observed that when signal is sent through some transmission media, it is
subjected to attenuation, distortion and noise. As a result, some of the bits of the data of the
signal get corrupted. In other words, it leads to some errors in sending data. Hence, we have to
devise mechanism for detecting and correcting the errors during transmission. In this paper, that
shall be our focal point and would be considering the followings: why error detection and
correction? types of error, error detection techniques, such as parity check, two dimensional
parity check, checksum, cyclic redundancy check, polynomials and error correcting codes like
hamming code.

Contents

Abstract
Introduction
Why error detection and correction?
Types of errors
Error detection techniques
Use of redundancy
- Parity check
- Two dimensional parity check
- Checksum
- Cyclic redundancy check
- Polynomials
Error correcting codes
- Hamming codes

ii

Page 1 of

Introduction

12

Network must
be
able
to
transfer
data
from one device
to another with
acceptable
accuracy. For
most
applications,
a
Why Error Detection
and Correction?
system
must
guarantee
Because that
of attenuation, distortion, noise and interferences, errors during transmission are
the
data
inevitable, leading to corruption transmitted bits.
received
are
identical
Longertothetheframe size and higher the probability of single bit error, lower is the probability
receiving
a frame without error i.e. the probability of receiving a frame without error
data
increases
with the size of the frame and also as d probability of d single bit error increases.
transmitted.
time
dataemphasizes the need for error detection and error correction.
AnyThis
clearly
are transmitted
from
node
Typesone
of Errors
to the next, they
Whenever
bits flow from one point to another, they are subject to unpredictable changes because
can
become
of
interference. This interference can change the shape of the signal.
corrupted
in
passage.
i.
Single-Bit
Many
factors Error
ii. alter
Burst
can
one Error
or
more bits of a
message. Some
Single-Bit
Error
applications
The
term
require
a single-bit error means that only one bits gets corrupted i.e. only 1 bit of a given data
unit
(such
a byte, character, or packet) is changed from 1 to 0 or from 0 to 1. This error is
mechanismas for
common in parallel transmission of data. The figure below shows the effect of a single-bit error on a
detecting and
data unit.
correcting
errors.
Error
detection and
Correction has
great practical
importance in
maintaining
Burst
(Multiple) Error
data
The
term burst error means that more than one bits get corrupted i.e. 2 or more bits in the data
(information)
unit
have changed
integrity
across from 1 to 0 or from 0 to 1. This error is very common in serial transmission of
data.
noisy
communication
networks
channels
and
less
than
reliable storage
media.

Page 2 of
12

The figure below shows the effect of a burst error on a data unit. In this case, 0100010001000011
was sent, but 0101110101100011 was received. Note that a burst error 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.

Error Detection Techniques


Error detection is sending of additional information so incorrect data can be detected and
rejected. Error detection is the ability to detect the presence of errors caused by noise or other
impairments during transmission from the transmitter to the receiver.
Error detection uses the concept of redundancy, which means adding extra bits for detecting
error at the destination.
Use of redundancy: To detect or correct errors, we need to send extra (redundant) bits with data.
The extra bits are discarded as soon as the accuracy of the transmission has been determined.

Page 3 of
12

Thus, redundancy is the basic mechanism for detecting and correcting errors. Listed below are
popular techniques for detecting errors:

Simple Parity check


Two-dimensional Parity check
Checksum and
Cyclic redundancy check

Simple Parity check


The word par from parity is Greek words which often used in golf e.g. people are on par, i.e.
having something to do with equality or equivalence. Remember in a network, we send data in
packets which can vary in size, but one of the most common packet size is in byte (1 byte is short
for 8 bits).
The parity check is the simplest and the most popular error detection scheme. A parity bit is
appended to the original data bits to create an even or odd bit number. The source then transmits
this data via a link, and bits are checked and verified at the destination. Data is considered
accurate if the number of bits (even or odd) matches the number transmitted from the source.
The figure below captures the basic concept of parity check.

Page 4 of
12

There are 2 types of parity check, namely:


i.
ii.

Even parity - an even number of bits are 1 Even parity - data: 1010001, parity bit 1
Odd parity - an odd number of bits are 1 Odd parity - data: 1010111, parity bit 0

Example
Assumin
g Caleb
wants to
tell
Rhoda
EVEN
0
0
1
1
0
1
1
0
that
is
12 he 64
16
8
4
P
2
1
278 years
old
by Message or signal
parity bit
sending
Sender node - Caleb
27
to
Rhoda
Supposed
over the what was received by Rhoda (i.e. receiver node) due to interference or impairments is
this:
network
and they
have
0
0
1
1
0
0
1
0
12
64
16
8
4
P
2
1
both
8
agreed
Message or signal
parity bit
on even
parity
Receiver node - Rhoda
(i.e. even
numbers
Then, Rhoda is getting incorrect message of 25 years old instead of 27 years because one of the
of 1 with
bits had changed from 1 to 0. But by the time Rhoda counts the number of 1s in the message,
parity bit
she will detects there is an error because she will have odd result instead of even.
inclusive
)For
so Odd
as toParity:
check for
error
in Rhoda both agreed on sending the message with odd parity i.e. the number of 1s and
Caleb and
course
of inclusive should be odd. We have:
parity but
the data
transmiss
ODD
0
0
1
1
0
1
1
1
ion.
12
64
16
8
4
2
1
P
8

Message or signal

Sender node - Caleb

parity bit

Page 5 of
12

Supposed what was received by Rhoda (i.e. receiver node) due to interference or impairments is
this: Single-Bit Error
0

12
8

64

16

Message or signal

parity bit

Receiver node - Rhoda

Rhoda will know there is an error


because the number of 1s in the
message is even which ought to be
odd based on their agreement.

But what if we have something like this? Will she detects the error?
Multiple (Burst) error:

12
8

64

16

Message or signal

Receiver node - Rhoda

parity bit

No! Rhoda will not be able to detect


the error because after counting the
number of 1s in the message she will
have odd result which is in line with
their agreement.

Advantages
i.
ii.

Simple parity check can detect all single-bit errors.


It can also detect burst errors, only when the number of bits in error is odd.

Disadvantage
i.
ii.

The technique is not foolproof against burst errors that invert more than one bit.
Particularly, if even numbers of bits are inverted due to error, the error is not detected.
The receiver cannot specify which bit is/are in error.

To overcome this limitation, two dimensional parity check technique was introduced.
Two Dimensional Parity Check
Performance can be improved by using two-dimensional parity check, which organizes the
block of bits in the form of a table.
Parity check bits are calculated for each row, which is equivalent to a simple parity check
bit.
Parity check bits are also calculated for all columns.
Both are sent along with the data.
At the receiving end these are compared with the parity bits calculated on the received data.

Page 6 of
12

Example

Advantage
i.
It increases the likelihood of detecting burst errors.
ii.
Extra overhead is traded for better error detection capability.
Disadvantage
i.
If two bits in one data unit are changed and two bits in exactly at same position in another
data unit are changed, the checker cannot detect an error.

Checksum
The senders end:
The data is divided into k segment each of m bits.
The segments are added using ones complement arithmetic to get the sum.
The sum is complemented to get the checksum.
The checksum segment is sent along with the data segments.

Suppose the following block of 16 bits is to be sent using a checksum of 8 bits.


10101001 00111001
The numbers are added using ones complement
10101001
00111001
-----------Sum
11100010
Checksum

00011101

Page 7 of

The pattern sent is

10101001 00111001 00011101

12

The receivers end:


All received segments are added using ones complement arithmetic to get the sum.
The sum is complemented.
If the result is zero, the received data is accepted; otherwise discarded.

Now suppose the receiver receives the pattern sent above 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.
Advantages
i.
The checksum detects all errors involving an odd number of bits.
It also detects most errors involving even number of bits.
ii.
iii Has lesser extra overhead compare to two dimensional parity checks.
.
Disadvantage
i.
If the value of one word is incremented and the value of another word is decremented by
the same amount, the two errors cannot be detected because the sum and checksum
remain the same.
Also if the values of several words are incremented but the total change is a multiple of
ii.
65535, the sum and the checksum does not change, which means the errors are not
detected.
Cyclic Redundancy Check (CRC)

One of the most powerful and commonly used error detecting codes.

Basic Approach:

Given a m-bit block of bit sequence, the sender generates an n-bit sequence, known as a
frame check sequence (FCS), so that the resulting frame, consisting of m+n bits, is
exactly divisible by same predetermined number.
The receiver divides the incoming frame by that number and, if there is no remainder,
assume there was no error

The figure below further show steps in CRC:

Page 8 of
12

Figure: CRC generator and checker


Polynomials
All the values can be expressed as polynomials of a dummy variable X.
P = 11001 => X4 + X3 + 1

CRC process can be expressed as XnM(X)/P(X) = Q(X) + R(X) / P(X)


Commonly used divisor polynomials:

CRC-16 = X16 + X15 + X2 + 1

CRC-CCITT = X16 + X12 + X5 + 1

Advantages
32
= Xdetect
+ X26
X23 + X22 +errors.
X16 + X12 + X11 + X10 + X8 + X7 + X5 + X4 + X2 + 1
i. CRC-32
CRC can
all+ single-bit
ii. CRC can detect all double-bit errors (three 1s).
iii. CRC can detect any odd number of errors (X + 1).
iv. CRC can detect all burst errors of less than the degree of the polynomial.
v. CRC detects most of the larger burst errors with a high probability.
Error Correction
Error correction is sending of additional information so incorrect data can be corrected and
accepted. Error correction is the additional ability to reconstruct the original, error-free data.
Two Basic Approaches:
- Backward error correction/correction by retransmission: When an error is detected in a
frame, the sender is asked to retransmit the data/frame. This approach is known as
Automatic Repeat Request (ARQ) technique.

Page 9 of

12

Forward error correction: is the process in which the receiver tries to guess the message
by using redundant bits. Redundancy is used in the transmitted data to not only detect but
correct error in the received data.

Key idea:
- Requirement for error detection: A code is an error-detecting code if and only if the
minimum distance between any two code words is two.
- Requirement for error correction: For a code to be error-correcting, the minimum
distance between any two code words must more than two.
Number of additional bits should such that it can point the position of the bit in error. If K

is the number of additional bits, then the condition is 2 k > m + k + 1


Hamming Codes
Hamming code is a set of error-correction codes that can be used to detect and correct bit errors
that can occur when computer data is moved or stored.
Calculate Hamming Code by Example
Data: 1001101
1) Calculating the number of redundancy (parity) bits required. Since numbers of data bits is
7, the value of r is calculated as
Formula: 2r m + r + 1
Testing for value of r:
If r = 3

2r m + r + 1 => 23 7 + 3 + 1 => 8 11 ----- False


If r = 4

2r m + r + 1 => 24 7 + 4 + 1 => 16 12 ----- True


Therefore, number of redundancy (parity) bits = 4
2) Determining the position of various data bits and redundancy bits. The various r bits are
placed at the position that corresponds to the power of 2 i.e. 2 0, 21, 23, 24 which gives
1,2,4,8 respectively.
Thus, the packet looks like this:
P

11

10

r4
8

Where P stands for redundancy (parity) bits

r3
4

1
3

r2

r1

Page 10 of

3) Determining the values of r , r , r , and r using VRC Vertical Redundancy Check


1 2 3
4
1

11

10

r4
8

r3
4

r2
2

r1
1

Using XOR operation to calculate the parity bit, the following rules holds:
1

1=0

0=0

0=1

1=1

Hence,
For r1:

3 5 7 9 11
1 0 1 0 1
1
1
1
1
0
1

r1 is VRC for bits 1, 3, 5, 7, 9, 11 i.e. 1

Uu8

Thus, r1 = 1

For r2:

11

10

r4
8

r3
4

1
3

r2
2

1
1

r2 is VRC for bits 2, 3, 6, 7, 10, 11

calculating for r2 using the process above; r2 = 0


For r3:

11

10

r4
8

r3
4

r3 is VRC for bits 4, 5, 6, 7

calculating for r3 using the process above; r3 = 0

12

Page 11 of
12

For r4:

11

10

r4
8

r4 is VRC for bits 8, 9, 10, 11

calculating for r4 using the process above; r4 = 1


Therefore, the transmitted signal/message is: 10011100101 (where the bold bits are the
parity bits) -- 1 0 0 1 1 1 0 0 1 0 1
On the receiver side if any data bit is changed the receiver recalculates parity bit for the
received data bit. Comparing the sent parity and recalculated parity bits, location of bit in
error is identified; the receiver can reverse its value and correct the error.

Conclusion
Error detecting and correcting codes are essential to computing and all sorts of
communications. To detect or correct errors, we need to send extra (redundant or parity)
bits with data. Error correction is more tedious than the detection.
Hamming codes is one of the most powerful and assuring techniques out of the
techniques discussed in detecting and correcting errors.

Page 12 of
12

References
V.S. Bagad, I.A. Dhotre, Computer Networks 4th Edition, 2009
Behrouz A. Forouzan, Data Communication and Networking 4th Edition, 2007

Potrebbero piacerti anche