Home > Back-end >  Master to help, please look at the calculation method of the check code
Master to help, please look at the calculation method of the check code

Time:11-15

Master to help have a look at FC, 6 d, 0 d, 74, F6, of which 74, F6 is double check, data is FC, 6 d, 0 d, such as data EC again, BB, 11, 2 B, D9, among them 2 B, D9 is double check code, data is EC, BB, 11 the master to help work it out, and the calculation method of check code thank thank

CodePudding user response:

The data on the chart is the same calibration method

CodePudding user response:

CRC - 16/CCITT - FALSE (x16 + x12 + x 5 + 1)

http://www.ip33.com/crc.html

CodePudding user response:

CodePudding user response:

References from algorithm: https://www.cnblogs.com/yf142857/p/7245758.html
 
The function CRC16_CCITT_0xFFFF (Bytes: TBytes) : Word;
Const
Polynomial=$1021;
Var
CRC: Word;
I, J: Integer;
B: a Byte;
Bit, C15: Boolean;
The begin
CRC:=$FFFF;//initial value
For I:=0 to High (Bytes) do
The begin
B:=Bytes [I];
For J:=0 to 7 do
The begin
Bit:=(((B SHR (7 - J)) and 1)=1);
C15:=(SHR CRC (15) and (1)=1);
The CRC: CRC SHL=1;
If (C15 xor Bit) then CRC:=CRC xor Polynomial;
end;
end;
Result:=CRC and $FFFF;
end;

Procedure TForm1. FormCreate (Sender: TObject);
Const
Data: TBytes=[$FC, $6 d, $0 d];
Var
CRC: Word;
HexStr: AnsiString;
The begin
The CRC: CRC16_CCITT_0xFFFF=(Data);
SetLength (HexStr, 4);
BinToHex (@ CRC, PAnsiChar (HexStr), 4);
ShowMessage (String (HexStr));
end;

CodePudding user response:

refer to the second floor BlueStorm response:
CRC - 16/CCITT - FALSE (x16 + x12 + x 5 + 1)

http://www.ip33.com/crc.html

Thank you thank you, help me to solve the problem finally
  • Related