Chapter 4 - Lecture-1 Error Detection and Hamming Code
Chapter 4 - Lecture-1 Error Detection and Hamming Code
Error Control
References:
Chapter 6 - Data and Computer Communications, by William
Stallings
Lecture - Outline
❑Asynchronous and Synchronous Transmission
❑Types of error
❑Error detection techniques
➢Parity check
➢Two dimensional parity check
➢Checksum
➢Cyclic redundant check
❑Error correction code
➢Hamming code
Asynchronous and Synchronous
Transmission
❑The receiver must know the rate at which bits are being received so
that it can sample the line at appropriate intervals to determine the
value of each received bit.
❖asynchronous transmission
❖synchronous transmission
Asynchronous Transmission
Each character of data is treated independently. The strategy with this scheme is to
avoid the timing problem by not sending long, uninterrupted streams of bits.
❑cheap
~ means that 2 or more consecutive bits in the data unit have changed
❑Detection methods
1. Parity Check - Vertical Redundancy Check
❑The simplest error-detecting scheme is to append a parity bit to the end
of a block of data.
❑A parity bit is added to every data unit so that the total number of 1s
(including the parity bit) becomes even for even-parity check or odd
for odd-parity check
parity-check
❑A simple parity-check code can detect an odd number of errors.
❑Note, however, that if two (or any even number) of bits are
inverted due to error, an undetected error occurs.
❑The use of the parity bit is not perfect, as noise impulses are often
long enough to destroy more than one bit, particularly at high data
rates.
2. Cyclic Redundancy Check (CRC)
❑One of the most common, and one of the most powerful, error-
detecting codes is the cyclic redundancy check (CRC).
❑The receiver then divides the incoming frame by that number and,
if there is no remainder, assumes there was no error.
CRC(Cyclic Redundancy Check)
~ is based on binary division.
Modulo 2 arithmetic uses binary addition with no carries,which is just the exclusive-OR (XOR)
operation. Binary subtraction with no carries is also interpreted as the XOR operation: For example,
Calculating and Using CRCs
1. Let the information byte F = 1001011
2. The sender and receiver agree on an arbitrary binary pattern P.
❖ Let P = 1011.
3. Shift F to the left by 1 less than the number of bits in P.
❖ Now, F = 1001011000.
4. Let F be the dividend and P be the divisor. Perform “modulo 2
division”.
5. After performing the division, we ignore the quotient. We got 100 for
the remainder, which becomes the actual CRC checksum.
6. Add the remainder to F, giving the message M:
1001011 + 100 = 1001011100 = M 24
Calculating and Using CRCs
7. M is decoded and checked by the message receiver using the
reverse process.
____1010100
1011 | 1001011100
1011
001001
1001
0010
001011
1011
0000 Remainder
25
3. Checksum
❑Checksum Generator
Error Correction
❑ Can be handled in two ways
24 7 + 4 + 1
Error Correction(cont’d)
❑Relationship between data and redundancy bits
1 2 3
2 3 5
3 3 6
4 3 7
5 4 9
6 4 10
7 4 11
Hamming Code
❑ Single parity bit can only detect error, not correct it
❑ The key to the Hamming Code is the use of extra parity bits to
allow the identification of a single error.
r1 = bits 1, 3, 5, 7, 9, 11
r2 = bits 2, 3, 6, 7, 10, 11
r4 = bits 4, 5, 6, 7
r8 = bits 8, 9, 10, 11
Error Correction(cont’d)
❑Redundancy bits calculation(cont’d)
Error Correction(cont’d)
❑Redundancy bits calculation
Error Correction(cont’d)
❑Calculating the r values
Calculating Even
Parity
Error Correction(cont’d)
❑Error Detection and Correction
Error Correction(cont’d)
❑Error detection using Hamming Code
Summary
❑ Types of Error Detection/Correction Methods
- Hamming Codes
42