LRC check calculator, also known as longitudinal redundancy check calculator, is a common error code check tool in the communication field, which can be used for LRC algorithm check of Modbus protocol ASCII mode.
The LRC check code calculation method is a common error detection check method for computer communication and embedded serial port programming, also known as Longitudinal Redundancy Check.
The basic calculation method of the LRC check code is to sum the ASCII code characters transmitted in the communication, without considering the carry, and then reverse the bitwise bit, and finally add 1 to the result to convert it to the corresponding character is the LRC check code.
Example calculation method:
The first calculation method:
After the characters are converted into ASCII codes, accumulation is performed, and the result is increased by 1 after inversion.
String ASCII Hex
3 => 33 => 0011 0011
5 => 35 => 0011 0101
6 => 36 => 0011 0110
=========================
1001 1110 = 9E
=========================
9E%100=9E 100-9E = 62
The LRC code of 356 is 62
The second calculation method:
String ASCII Decimal
3 => 33 => 51
7 => 37 => 55
1 => 31 => 49
===========================
51+55+49 = 155
===========================
155%256=155 256-155 = 101
101 converted to hexadecimal equals 65, LRC check code is 65