Computer Network No.5 (Cont... Datat Link Layer) From APCOMS
Computer Network No.5 (Cont... Datat Link Layer) From APCOMS
Packetizing Addressing
To correct a “single-bit” error in an ASCII What if an error occurs in redundancy bits???
character, the error correcting code must So we have to cater for 10 bits (7 data + 3
determine which of the 7 bits has changed. redundant)
So it has to distinguish between eight Hence 3 bits are insufficient for 7 bit data.
different states:
To calculate “r” redundant bits for “m” data
o No error
o Error in position 1
bits, consider this:
o Error in position 2 o r must be able to indicate m + r +1 states. Why????
o … o For m + r error states and 1 no-error state.
o Error in position 7 Since r can represent 2r states, so 2r must
It “seems” 3 redundant bits are required to be greater than or equal to m+r+1
represent these 8 states (000 – 111). o 2r >= m + r + 1
Faisal Amjad CPS 422 Faisal Amjad CPS 422
1
THE HAMMING CODE THE HAMMING CODE
Can be applied to data units of any length and Each redundant r bit is the parity bit for one
uses the same relationship between data and combination of data bits as fol :-
redundant bits. o r1 bits 1,3,5,7,9,11
Redundant bits are interspersed with data o r2 bits 2,3,6,7,10,11
bits at positions which are powers of 2, e.g. o r4 bits 4,5,6,7
1,2,4,8... o r8 bits 8,9,10,11
These bits are represented as r1,r2,r4,r8 etc. Plug in the data bits at their respective
locations
11 10 9 8 7 6 5 4 3 2 1
Calculate each r bit as parity of the bit-
d d d r8 d d d r4 d r2 r1 combination mentioned above
11 10 9 8 7 6 5 4 3 2 1
Data bits are : 1001101 1 0 0 1 1 0 1
1 0 0 1 0 1 0 0 1 0 1
o CRC
o Checksum
1 0 0 1 0 1 0 0 1 0 1
o Hamming Code
1 0 0 1 0 1 0 0 1 0 1
1 0 0 1 0 1 0 0 1 0 1
Error position = 7 0 1 1 1