Error Detect
Error Detect
ERROR Detection
ERROR Detection
Error Detection
Error in bits during transmission from source to destination
Solution
Error detection using Parity Check, CRC and Checksum
Correction using Hamming techniques and data flow
Introduction
Single bit error one bit of data change from 1 to zero or zero to one
Errors in the received frames are detected by some popular techniques for
error detection which are:
If the counter-check at receiver’ end fails, the bits are considered corrupted.
Parity Check
One extra bit is sent along with the original bits to make number of 1s
either even in case of even parity, or odd in case of odd parity.
The sender while creating a frame counts the number of 1s in it.
For example, if even parity is used and number of 1s is even then one bit
with value 0 is added. This way number of 1s remains even. If the
number of 1s is odd, to make it even a bit with value 1 is added.
The receiver simply counts the number of 1s in a frame. If the count of 1s is
even and even parity is used, the frame is considered to be not-corrupted
and is accepted. If the count of 1s is odd and odd parity is used, the frame is
still not corrupted. The figure bellow makes the total number of 1’s even,
that is why it is called even parity checking
Two-dimensional Parity check
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, then both are sent along with the data. At the receiving end
these are compared with the parity bits calculated on the received data.
Checksum
15
General Algorithm of Hamming code
The Hamming Code is simply the use of extra parity bits to allow the identification of an error.
Write the bit positions starting from 1 2 3 4 6 7 … etc.
All the bit positions that are a power of 2 are marked as parity bits 20 21 22 23 24 (1, 2, 4, 8, etc).
All the other bit positions are marked as data bits.
Each data bit is included in a unique set of parity bits, as determined its bit position in binary form.
a. Parity bit 1 covers all the bits positions whose binary representation includes a 1 in the least
significant position (( )اول رقم يمين1, (3, 5, 7, 9, 11, etc).
b. Parity bit 2 covers all the bits positions whose binary representation includes a 1 in the second
position from the least significant bit ( 1 (الرقم التانى من اليمين يكون2, (3, 6, 7, 10, 11, etc).
c. 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–7, 12–15, 20–23, etc).
d. Parity bit 8 covers all the bits positions whose binary representation includes a 1 in the fourth
position from the least significant bit bits (8(9–15, 24–31, 40–47,etc)
Since we check for even parity,
set a parity bit to 1 if the total number of ones in the positions it checks is odd.
Set a parity bit to 0 if the total number of ones in the positions it checks is even
Example
These redundancy bits are placed at the positions which correspond to the
power of 2.
As in the example:
The number of data bits = 7 n number of bits, p number of parity bit
2p>=n+p+1
The number of parity bits = 4 not 3 because if 3 the bit 8 not examined
The total number of bits = 11
Suppose the data to be transmitted is 1011001, the bits will be placed as follows:
Determining the Parity bits
R1 bit is calculated using parity check at all the bits positions whose binary
representation includes a 1 in the least significant position.
R1(p1): bits 1, (3, 5, 7, 9, 11)
Then bit R1 = 0 , Since the total number of 1’s in all the bit positions corresponding to R1 is an even
R2 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1 in the second position from the least significant bit.R2: bits 2,(3,6,7,10,11)
Since the total number of 1’s in all the bit positions corresponding to R2 is an odd number the value of
R2(parity bit’s value)=1
R4 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1 in the third position from the least significant bit.R4: bits 4, (5, 6, 7)
Since the total number of 1’s in all the bit positions corresponding to R4 is an odd number the value of
R4(parity bit’s value) = 1
R8 bit is calculated using parity check at all the bits positions whose binary representation includes a
1 in the fourth position from the least significant bit.R8: bit 8,(9,10,11)
Since the total number of 1’s in all the bit positions corresponding to R8 is an even number the
value of R8(parity bit’s value)=0.
Thus, the data transferred is:
Example of Hamming Code
Error detection and correction using 7 bits
hamming code