文件名称:CRC.C
介绍说明--下载内容均来自于网络,请自行研究使用
下面以最常用的CRC-16为例来说明其生成过程。
CRC-16码由两个字节构成,在开始时CRC寄存器的每一位都预置为1,然后把CRC寄存器与8-bit的数据进行异或(异或:二进制运算 相同为0,不同为1;0^0=0 0^1=1 1^0=1 1^1=0),
之后对CRC寄存器从高到低进行移位,在最高位(MSB)的位置补零,而最低位(LSB,移位后已经被移出CRC寄存器)如果为1,则把寄存器与预定义的多项式码进行异或,否则如果LSB为零,则无需进行异或。重复上述的由高至低的移位8次,第一个8-bit数据处理完毕,用此时CRC寄存器的值与下一个8-bit数据异或并进行如前一个数据似的8次移位。所有的字符处理完成后CRC寄存器内的值即为最终的CRC值。
-Below the most commonly used CRC-16 as an example to illustrate the generation process.
CRC-16 yards by two-bytes at the beginning of every one of the CRC register is preset to 1, then the CRC register with the 8-bit data XOR (exclusive or: the same as the binary operation 0, different 1 0 ^ 0 = 0 0 ^ 1 = 1 1 ^ 0 = 1 1 ^ 1 = 0),
After the shift the CRC register from highest to lowest, the most significant bit (MSB) position zeros, the least significant bit (LSB after the shift has been out of the CRC register) 1, put the register with pre-defined item code different, or, otherwise, if the LSB is zero, you do not need to XOR. Repeat the above the descending order of the shift eight times, the first 8-bit data processing is completed, such as previous data like 8 times shift the CRC register values and the next 8-bit data XOR and . After completion of all the characters deal with the value of the CRC register is the final CRC value.
CRC-16码由两个字节构成,在开始时CRC寄存器的每一位都预置为1,然后把CRC寄存器与8-bit的数据进行异或(异或:二进制运算 相同为0,不同为1;0^0=0 0^1=1 1^0=1 1^1=0),
之后对CRC寄存器从高到低进行移位,在最高位(MSB)的位置补零,而最低位(LSB,移位后已经被移出CRC寄存器)如果为1,则把寄存器与预定义的多项式码进行异或,否则如果LSB为零,则无需进行异或。重复上述的由高至低的移位8次,第一个8-bit数据处理完毕,用此时CRC寄存器的值与下一个8-bit数据异或并进行如前一个数据似的8次移位。所有的字符处理完成后CRC寄存器内的值即为最终的CRC值。
-Below the most commonly used CRC-16 as an example to illustrate the generation process.
CRC-16 yards by two-bytes at the beginning of every one of the CRC register is preset to 1, then the CRC register with the 8-bit data XOR (exclusive or: the same as the binary operation 0, different 1 0 ^ 0 = 0 0 ^ 1 = 1 1 ^ 0 = 1 1 ^ 1 = 0),
After the shift the CRC register from highest to lowest, the most significant bit (MSB) position zeros, the least significant bit (LSB after the shift has been out of the CRC register) 1, put the register with pre-defined item code different, or, otherwise, if the LSB is zero, you do not need to XOR. Repeat the above the descending order of the shift eight times, the first 8-bit data processing is completed, such as previous data like 8 times shift the CRC register values and the next 8-bit data XOR and . After completion of all the characters deal with the value of the CRC register is the final CRC value.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
CRC.C.docx