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

CH 10

Uploaded by

Harsh Singhal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

CH 10

Uploaded by

Harsh Singhal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Error Detection and

Correction
• We know that when the signal travels through a transmission medium it
suffers from various transmission impairments such as Attenuation,
Distortion and Noise.
• Out of it Noise plays a major role in introducing the Error in the signal.
• Error in the signal means changing the original bit value of the signal
that means a 0 bit may change to 1 or a 1 bit may change to 0.
Original Signal 0111_____(Noise)_____ 0101 (Error)
Classification of Error
a) Single Bit Error b) Burst Error
• The term single-bit error means
that only 1 bit of a given data
unit (such as a byte, character,
or packet) is changed from 1 to
0 or from 0 to 1.
• The term burst error means that
2 or more bits in the data unit
have changed from 1 to 0 or
from 0 to 1.
• To make error detection or correction possible we add certain extra
bits at the end of data bits.
• The extra bits are also called as Redudant bits
• These redundant bits are added by the sender and removed by the
receiver.
• Their presence allows the receiver to detect or correct corrupted bits.
Detection versus Correction
• The correction of errors is more difficult than the detection.
• In the Error detection, once the receiver detects an error in the Frame it rejects the Frame sends
its Neagtive Acknowledgement to the Sender and it is the responsibilty of the sender to retransmit
the Frame again
Some popular techniques for error detection are:
1. Simple Parity check 2. Two-dimensional Parity check 3. Checksum
4. Cyclic redundancy check
• In error correction, once the receiver detects an error now the responsiblity of correcting the
error left with the receiver only. The task of the receiver is
• To know the exact number of bits that are corrupted and, more importantly, at what bit positions
the error happens.
Error Correcting Code
1 Hamming Code
Hamming Code is able to detect and correct only single bit error.
• Simple Parity Check
It is the simplest and the most popular error detection technique.
A single Parity bit is added at the end of data bits.
It is of two types
a) Even Parity b) Odd Parity
In Even Parity the total number of 1 ' s including the Parity bit should be even.
In Odd Parity the total number of 1 ' s including the Parity bit should be odd.
For example Let the Data bits to be sent are 1011001 using even parity
Parity bit is added at the end of data bit ,to make it even count the number of 1's
present in the Data bits . 4 1's in the Data Bits so for the Even Parity the the total
number of 1 ' s including the Parity bit should be even so the Parity bit 0 is appended at
the end of the Data Bits. 10110010
Encoder and Decoder for Simple Parity
Check

Data bits are called as Data Word


Once Parity is added at the end ofthe Data Word then that becomes the Code Word.
It is the Code Word that gets exchanged over the transmission medium.
Syndrome is the result of the Parity check on the received Code Word.
For the( even parity) the receiver count number of 1's including Parity if it is even
then syndrome is 0 ,accept the Frame otherwise reject the Frame.
a3 a2 a1 a0 P
1 0 1 1 1

Assume the sender sends the dataword 1011 using Even Parity The codeword becomes
10111, which is sent to the receiver.
We examine five cases for the even parity system we are using.
Case I: The received codeword is 10111. The syndrome is 0. No Error in the received
Frame,so The dataword 1011 is accepted by the receiver.
Case 2 :One single- bit error changes a1. The received codeword is 10011.
The syndrome is 1 . Error in the received Frame so The dataword 1011 is not accepted
by the receiver.
Case 3:The parity bit, in our example changes. So now 10111 is 10110
The syndrome is 1 . Error in the received Frame so The dataword 1011 is not accepted
by the receiver.
a3 a2 a1 a0 P
1 0 1 1 1
case 4 Suppose now that we have two changes at a3 and Parity Bit .
The received codeword is 00110. The syndrome is 0. • The dataword 0011 is accepted
at the receiver. • Note that here the dataword is wrongly accepted
Case 5:
Suppose now we have three changes at a3 a2 a1 and the received codeword is 01011.
The syndrome is 1.The dataword is not accepted by the Receiver.
Checksum
• In checksum the data is divided into k segments each of m bits.
• At the sender’s side all the segments are added using 1’s complement arithmetic to get the
sum( In 1's Complement the end around carry bit is always added to the least significant
bit).
• The obtained 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 obtained sum is complemented. If the result is zero, the received data is accepted;
otherwise discarded.
• Suppose the message is a list of five 4-bit numbers that we want to send to a
destination. In addition to sending these numbers, we send the sum of the
numbers. For example, if the set of numbers is (7, 11, 12, 0, 6), we send (7, 11,
12, 0, 6, 36), where 36 is the sum of the original numbers. The receiver adds the
five numbers and compares the result with the sum. If the two are the same, the
receiver assumes no error, accepts the five numbers, and discards the sum.
Otherwise, there is an error somewhere and the message not accepted.
• In the previous example, the decimal number 36 in binary is (100100)2. To
change it to a 4-bit number we add the extra leftmost bit to the right four bits as
shown below.

Instead of sending 36 as the sum, we can send 6 as the sum (7, 11, 12, 0, 6, 6). The
receiver can add the first five numbers in one’s complement arithmetic. If the
result is 6, the numbers are accepted; otherwise, they are rejected.
• Let us use the idea of the checksum . The sender adds all five numbers in one’s
complement to get the sum = 6. The sender then complements the result to get
the checksum = 9, which is 15 − 6. Note that 6 = (0110)2 and
• 9 = (1001)2; they are complements of each other. The sender sends the five data
numbers and the checksum (7, 11, 12, 0, 6, 9). If there is no corruption in
transmission, the receiver receives (7, 11, 12, 0, 6, 9) and adds them in one’s
complement to get 15
Cyclic Redudancy Check

CRC is based on binary division.


• In CRC, a sequence of redundant bits, called cyclic redundancy 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(based on XOR operation). The
remainder is the CRC.
• The CRC obtained is added at the end of the data units and send towards the receiver
• At the destination, the incoming data unit is divided by the same number. 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.
• CRC generator generates the Predetermine
Divisor that generally expressed in terms
of Polynomial of a dummy Variable X.
• for example:
The Predetermine divisor 1011
can be expressed as the Power of Positions
can be written as
=X 3 + X1 + X0 .
If CRC generator produces the
Predetermine divisor of n bits then
append (n-1 ) zero to data bits.
• Hamming code is a set of error-correction codes that can be used to detect and
correct the Single bit errors only.
• It is technique developed by R.W. Hamming in the year 1950.
• In the Hamming Code ,Certain Redudant bits or the Parity bits are added with
in the Data bits as well as at the end of the Data bits.
• How many number of Parity Bits should be added along with the Data Bits
• It is given by the formulae:
2p ≥ m+p+1
where p : Parity Bits
m: Data Bits or Message bits.
• 2p ≥ m+p+1
Here if m = 4(Data bits) then number of Parity bits can be calculated as
Find for what value of p the above equation satisfies.
Starting from p =1, 2 1 >= 4 +1+1 = 2 >= 6 ( Condition False)
Check for p = 2, 2 2 >= 4 +2+1 = 4>=7 (Condition False)
Check for p = 3, 2 3 >= 4+3+1 = 8>=8 (Condition true)
So for p =3 the equation satisfies.
The number of Parity Bits to be added along with the Data bits comes out to be 3.
The Length of Code Word = 4(Message bits) + 3(Parity bits) = 7 bits
Steps to Encode the Message at the Sender
Step 1 − Calculation of the number of Parity bits.
Step 2 − Positioning the Parity bits.
Step 3 − Calculating the values of each Parity bit.
Once the Parity bits are embedded within the message, this is sent to the user.
Steps to Decode a message At the Receiver
Once the receiver gets an incoming message, it performs the following Steps
• Step 1 − Calculation of the number of Parity bits.
• Step 2 − Find the Positioning of the Parity bits.
• Step 3 − Perform Parity checking.
• Step 4 − Error detection and correction
• Let us have 1 0 1 1 (data bits) to be sent towards the receiver.
• Here m = 4 , from the previous formulae we can find p = 3 parity bits to be
added with the data bits.
• Step 2 − Positioning the Parity bits.
Parity bits are always added at bit positions of powers of 2, i.e.
2 0 = 1 , 2 1 = 2, 2 2 = 4 , 2 3 = 8 , 2 4 = 16 etc.
In our example :
the first Parity bit occupies position 1.
the second Parity bit occupies position 2.
the third Parity bit occupies position 3.
D7 D6 D5 P4 D3 P2 P1
1 0 1 ? 1 ? ?
• Step 3 − Calculating the value of each Parity bit by the use of Data bits.
• Parity bit 1 covers all the bits positions whose binary representation includes a 1 in the least
significant bit. position (1, 3, 5, 7, 9, 11, etc).
• Binary represention of 1 in terms of 8 bits - 000 000 01
• Binary represention of 3 in terms of 8 bits - 000 000 11
• Binary represention of 4 in terms of 8 bits - 000 001 00(Not 1 in LSB) so wont consider for
P1.
• Parity bit 2 covers all the bits positions whose binary representation includes a 1 in the
second position from the least significant bit (2, 3, 6, 7, 10, 11, etc).
• Parity bit 4 covers all the bits positions whose binary representation includes a 1 in the
third position from the least significant bit (4,5,6,7, 12 etc).
• Binary represention of 4 in terms of 8 bits - 000 001 00( 1 in third position from LSB) so
considering for P3.
• As we are dealing with P =3 the value of P1,P2 and P4 can be
detrmined by the use of following Data bits.
• P1 = { D3, D5, D7 }
• P2 = { D3, D6 , D7 }
D7 D6 D5 P4 D3 P2 P1
• P4= { D5, D6 ,D7 }
• If even parity is used then 1 0 1 ? 1 ? ?
• P1 = { 1 , 1 , 1 } even parity so P1 = 1.
• P2 = { 1 , 0 , 1} even parity so P2 = 0.
• P4 = { 1, 0 , 1} even parity so P4 = 0.
• The following Code Word is sent towards the Receiver.

D7 D6 D5 P4 D3 P2 P1
1 0 1 0 1 0 1
D7 D6 D5 P4 D3 P2 P1
1 0 1 0 1 0 1

Suppose an error changes the value of D6.


The received Code Word is : D7 D6 D5 P4 D3 P2 P1
A) Receiver checks the value of the Parity Bits
P1 = { D3, D5, D7 } { 1 , 1 , 1} so P1 comes out
1
to be 1 . so the receiver deduce the value of P1 = 1 that matches 1 with1the received
0 1 P1. 0It puts1value
'0' in P1. P1 = 0
P2 = { D3, D6 , D7 } { 1, 1,1} so P2 comes out to be 1 .
so the receiver deduce the value of P2 = 1 that does not match with the received P2.
Receiver comes to know that there is an error.
It puts value '1' in P2. P2 = 1.
P4= { D5, D6 ,D7 } { 1 1 1} so P4 comes out to be 1.
so the receiver deduce the value of P4 = 1 that does not match with the received P4.
Receiver comes to know that there is an error.
It puts value P4 =1
The decimal equivalent of the parity bits binary values is calculated. If it is 0, there is no error.
Otherwise, the decimal value gives the bit position which has error.
P4 .P2.P1 = 1 1 0 ( decimal equivelent) = 6 so bit position 6 is having error. Invert the value of bit 0
• P4= { D5, D6 ,D7 } { 1 1 1} so P4
comes out to be 1.
D7 D6 D5 P4 D3 P2 P1
• so the receiver deduce the value of P4
= 1 that does not match with the
received P4. 1 1 1 0 1 0 1
• Receiver comes to know that there is
an error.
• It puts value P4 =1
• The decimal equivalent of the parity
bits binary values is calculated. If it is
0, there is no error. Otherwise, the
decimal value gives the bit position
which has error.
• P4 .P2.P1 = 1 1 0 ( decimal equivelent)
= 6 so bit position 6 is having error.
Invert the value of bit 0 to 1.

You might also like