Hamming code for 10010100111
The Hamming(15,11) code is an error-correcting code that adds four parity bits to an 11-bit data word, creating a 15-bit codeword. Here's a step-by-step guide to calculate the Hamming(15,11) code for binary number 10010100111:
Collect the 11-bit data word that you want to encode. For example, let's say you have a data word: 10010100111.
Identify the positions for the four parity bits (P1, P2, P4, P8). These bits will be placed at positions 1, 2, 4, and 8 of the 15-bit codeword. The other positions (3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15) - (D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11) will be filled with the data bits.
In our example: D1 - 1, D2 - 0, D3 - 0, D4 - 1, D5 - 0, D6 - 1, D7 - 0, D8 - 0, D9 - 1, D10 - 1, D11 - 1.
Calculate the values of the parity bits based on the data bits.
Parity Bit P1:
- P1 covers D1, D2, D4, D5, D7, D9, D11
- Calculate the parity over the data bits in these positions (inclusive). Set P1 to 1 if the total number of 1s is odd, otherwise set it to 0.
P1 = (1 + 0 + 1 + 0 + 0 + 1 + 1) % 2 = 0
Parity Bit P2:
- P2 covers D1, D3, D4, D6, D7, D10, D11
- Calculate the parity over the data bits in these positions (inclusive). Set P2 to 1 if the total number of 1s is odd, otherwise set it to 0.
P2 = (1 + 0 + 1 + 1 + 0 + 1 + 1) % 2 = 1
Parity Bit P4:
- P3 covers D2, D3, D4, D8, D9, D10, D11
- Calculate the parity over the data bits in these positions (inclusive). Set P4 to 1 if the total number of 1s is odd, otherwise set it to 0.
P4 = (0 + 0 + 1 + 0 + 1 + 1 + 1) % 2 = 0
Parity Bit P8:
- P8 covers D5, D6, D7, D8, D9, D10, D11
- Calculate the parity over the data bits in these positions (inclusive). Set P8 to 1 if the total number of 1s is odd, otherwise set it to 0.
P8 = (0 + 1 + 0 + 0 + 1 + 1 + 1) % 2 = 0
Insert the calculated parity bits into their respective positions in the codeword.