Craftsman G10-0R7G-2SB Manual page 143

Table of Contents

Advertisement

The CRC is first stored in 0xFFFF, and then a procedure is called to process the
consecutive six or more bytes in the frame with the values ​ ​ i n the current register. Only the
8Bit data in each character is valid for the CRC, and the start and stop bits as well as the
parity bit are invalid.
During the CRC generation process, each 8-bit character is individually or XORed
with the contents of the register, and the result moves to the least significant bit direction,
and the most significant bit is padded with 0s. The LSB is extracted and detected. If the
LSB is 1, the register is individually or different from the preset value. If the LSB is 0, it is
not performed. The entire process is repeated 8 times. After the last bit (bit 8) is
completed, the next octet is individually different from the current value of the register.
The value in the final register is the CRC value after all the bytes in the frame have been
executed.
This calculation method of CRC adopts the international standard CRC check rule.
When editing the CRC algorithm, the user can refer to the CRC algorithm of the relevant
standard to write a CRC calculation program that truly meets the requirements.
A simple function for CRC calculation is now provided for user reference
(programming in C)ÿ
unsigned int crc_cal_value(unsigned char *data_value,unsigned char data_length)
{
int i;
unsigned int crc_value=0xffff;
{
crc_value^=*data_value++;
for(i=0;i<8;i++)
{
if(crc_value&0x0001)
while(data_length--)
143

Advertisement

Table of Contents
loading

Table of Contents