CRC/LRC/Checksum Checking
The metacharacters sequence
%02X\c(poly,init,start-offset,end-offset)
is used to match the crc/checksum of input.
poly |
Polynomial (hex) to be used.
txxxx |
t - 0 for forward algorithm
t - 1 for reverse algorithm
xxxx - Polynomial to be used |
01021 |
CRC-CCIT |
08005 |
CRC-16 |
18408 |
CRC-CCIT Reverse |
1A001 |
CRC-16 Reverse |
2 |
CRC-16 modified for 7-bit characters. |
0001x |
7/8 Bits Checksum
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
0 |
0 |
0 |
1 |
Bits |
Type |
Result Modification |
Bits |
0 |
8 Bits Checksum |
1 |
7 Bits Checksum |
---|
|
Type |
|
Result Modification |
0 |
No Change |
1 |
1-Complement |
2 |
2-Complement |
3 |
No Change (16 Bits Check sum) |
---|
|
---|
|
---|
|
init |
Initial value (hex) |
start-offset |
Offset (decimal) of first character to start calculation. 0 for beginning of string |
end-offset |
Offset (decimal) of last character to end calculation. 0 for last character of string. -1 for second last character of string |
---|
e.g.
\x02%02u(\d+)\x2e%02X\c(12,0,0,0)\x03
will match the input
<02>00123456.3B<03>
CRC/Checksum Generation
The sequence in POLL and WRITE statements
%02X\c(poly,init,start-offset,end-offset)
is used to generate crc/checksum.
e.g.
Poll \x01%02u\a00%02X\c(5,0,0,0)\x03
will transmit (for device with address set to 12)
<01>12003C<03> |