Ch. 7 - Hamming Codes

# Ch. 7 - Hamming Codes - CNT 3004 – Hamming Code 1...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 7/7/2009 CNT 3004 – Hamming Code 1 Original 7 bits message b1 b2 b3 b4 b5 b6 b7 11 bits code word with check bits c1 c2 b1 c4 b2 b3 b4 c8 b5 b6 b7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 9 10 11 Check bits: C1, C2, C4, C8, …… Occupies power of two’s positions (1, 2, 4, 8, …..) Each one checks parity of a set of data bits. To know which check bits of the codeword take care of a particular data bit (bi), the bit position is decomposed into their power of two’s components. For example bit position 11 (b7) corresponds to C1, C2 and C8 (11=1+2+8): 3 (b1): 2+1 → C2 and C1 5 (b2): 4+1 → C4 and C1 6 (b3): 4+2 → C4 and C2 7 (b4): 4+2+1 → C4, C2 and C1 9 (b5): 8+1 C8 and C1 10 (b6): 8+2 → C8 and C2 11 (b7): 8+2+1→C8, C2 and C1 CNT 3004 – Hamming Code 2 b1 b2 b3 b4 b5 b6 b7 c1 c2 b1 c4 b2 b3 b4 c8 b5 b6 b7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 9 10 11 Parity Parity bits are found adding in modulo 2 their corresponding bits: C1 = Pos3 ⊕ Pos5 ⊕ Pos7 ⊕ Pos 9 ⊕ Pos11 = b1 ⊕ b2 ⊕ b4 ⊕ b5 ⊕ b7 C2 = Pos3 ⊕ Pos6 ⊕ Pos7 ⊕ Pos 10 ⊕ Pos11 = b1 ⊕ b3 ⊕ b4 ⊕ b6 ⊕ b7 C4 = Pos5 ⊕ Pos6 ⊕ Pos7 = b2 ⊕ b3 ⊕ b4 C8 = Pos9 ⊕ Pos10 ⊕ Pos 11 = b5 ⊕ b6 ⊕ b7 Example: For the Hamming code example lets code the ASCII character ‘H’ 1001000 b1 b2 b3 b4 b5 b6 b7 c1 c2 b1 c4 b2 b3 b4 c8 b5 b6 b7 1001000 1 2 3 4 5 6 7 1 2 1 3 4 001 5 6 7 8 000 9 10 11 1 7/7/2009 CNT 3004 – Hamming Code 3 b1 b2 b3 b4 b5 b6 b7 c1 c2 b1 c4 b2 b3 b4 c8 b5 b6 b7 1001000 1 2 3 4 5 6 7 1 2 1 3 4 001 5 6 7 8 000 9 10 11 Parity Parity bits are found adding in modulo 2 their corresponding bits: C1 = b1 ⊕ C2 = b1 ⊕ C4 = b2 ⊕ C8 = b5 ⊕ b2 ⊕ b3 ⊕ b3 ⊕ b6 ⊕ b4 ⊕ b5 ⊕ b7 = 1 ⊕ 0 ⊕ 1 ⊕ 0 ⊕ 0 = 0 b4 ⊕ b6 ⊕ b7 = 1 ⊕ 0 ⊕ 1 ⊕ 0 ⊕ 0 = 0 b4 = 1 ⊕ 0 ⊕ 0 = 1 b7 = 0 ⊕ 0 ⊕ 0 = 0 c1 c2 b1 c4 b2 b3 b4 c8 b5 b6 b7 00110010000 1 2 3 4 5 6 7 8 9 10 11 CNT 3004 – Hamming Code 4 Example: For the Hamming code example lets code the ASCII character ‘m’ 1101101 b1 b2 b3 b4 b5 b6 b7 c1 c2 b1 c4 b2 b3 b4 c8 b5 b6 b7 1101101 1 2 3 4 5 6 7 1 2 1 3 4 101 5 6 7 8 101 9 10 11 Parity bits are found adding in modulo 2 their corresponding bits: C1 = b1 ⊕ C2 = b1 ⊕ C4 = b2 ⊕ C8 = b5 ⊕ c2 b1 c4 b2 ⊕ b3 ⊕ b3 ⊕ b6 ⊕ b3 b4 ⊕ b5 ⊕ b7 = 1 ⊕ 1 ⊕ 1 ⊕ 1 ⊕ 1 = 1 b4 ⊕ b6 ⊕ b7 = 1 ⊕ 0 ⊕ 1 ⊕ 0 ⊕ 1 = 1 b4 = 1 ⊕ 0 ⊕ 1 = 0 b7 = 1 ⊕ 0 ⊕ 1 = 0 c8 b5 b6 b7 c1 b2 b4 11101010101 1 2 3 4 5 6 7 8 9 10 11 2 7/7/2009 CNT 3004 – Hamming Code 5 Checking the received message When a codeword arrives, the receiver examines each check bit, verifying the parity. Recalculates each Check bits as R1 R2 R4 R8 If all check bits are zero there are no errors. If an error occurs, then the sequence R1 R2 R4 R8 contains the position of the error. Knowing the position of the error, the receiver flips the respective bit. Example: The character m is sent as 11101010101 and there is an error in the last bit (position 11). So the word 11101010100 is received Parity bits are found adding in modulo 2 their corresponding bits: R1 = b1 ⊕ b2 ⊕ b4 ⊕ b5 ⊕ b7 = 1 ⊕ 1 ⊕ 1 ⊕ 1 ⊕ 0= 0 error 1 R2 = b1 ⊕ b3 ⊕ b4 ⊕ b6 ⊕ b7 = 1 ⊕ 0 ⊕ 1 ⊕ 0 ⊕ 0 = 0 error 1 R4 = b2 ⊕ b3 ⊕ b4 = 1 ⊕ 0 ⊕ 1 = 0 OK NO ERROR 0 R8 = b5 ⊕ b6 ⊕ b7 = 1 ⊕ 0 ⊕ 0 = 1 error 1 R1 R2 R4 R8 = 1101 1+2+8 =11 3 ...
View Full Document

## This note was uploaded on 10/05/2010 for the course CNT CNT 3004 taught by Professor K during the Spring '10 term at University of Central Florida.

Ask a homework question - tutors are online