关于 汉明码请教

来源:百度知道 编辑:UC知道 时间:2024/05/18 00:09:06
Hamming Code is designed to correct errors. The key to the Hamming Code is the use of extra parity bits to allow the identification of a single error. Mark all bit positions that are powers of two as parity bits. (positions 1, 2, 4, 8, 16, 32, 64, etc.) And all other bit positions are for the data to be encoded.(positions 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, etc.)

To each data bit, we expand it as the form 1+2+4…(e.g. 9=1+8) Then we mark parity bit at 2^i positon 1 or 0 to allow the number of all the data bit whose expandedness contains 2^i plus parity itself to be even or odd.

Here is an example:

A byte of data: 10011010
Create the data word, leaving spaces for the parity bits: _ _ 1 _ 0 0 1 _ 1 0 1 0
Calculate the parity for each parity bit (a ? represents the bit position being set):

Position 1 checks bits 1,3,5,7,9,11:
? _ 1 _ 0 0 1 _ 1 0 1 0. Even parity so set position 1 to a 0: 0 _ 1 _ 0 0 1 _ 1 0 1

POSITION就是把 1, 2, 4, 8, 16, 32, 64 这些2的0,1,2,3,4,5....次方的位置空出来,其他的位置依次填上原来的数 就变成了_ _ 1 _ 0 0 1 _ 1 0 1 0
3=1+2
5=1+4
6=2+4
7=1+2+4
9=1+8
10=2+8
11=1+2+8
12=4+8
比方说第三位影响第1和2标志位,第12位影响第4和8标志位,以此类推。
Position 1 跟1,3,5,7,9,11相关: 使得1,3,5,7,9,11标志位上的值异或得0 所以第1位是0
? _ 1 _ 0 0 1 _ 1 0 1 0. Even parity so set position 1 to a 0: 0 _ 1 _ 0 0 1 _ 1 0 1 0
其他这几个以此类推,不明白的话再发信息给我
Position 2 checks bits 2,3,6,7,10,11:
0 ? 1 _ 0 0 1 _ 1 0 1 0. Odd parity so set position 2 to a 1: 0 1 1 _ 0 0 1 _ 1 0 1 0

Position 4 checks bits 4,5,6,7,12:
0 1 1 ? 0 0 1 _ 1 0 1 0. Odd parity so set position 4 to a 1: 0 1 1 1 0 0 1 _ 1 0 1 0

Position 8 checks bits 8,9,10,11,12:
0 1 1 1 0 0 1 ? 1 0 1 0. Even parity so set position 8 to a 0: 0 1 1 1 0 0 1 0 1 0 1 0

Code word: 011100101010

嗯..
一个很严重的问题.