1. CRC check generates CRC
1. CRC check generates CRC
1.1. Instruction Description
Addr (starting address): Store the data when calculate the CRC check code in an area starting from Dn, and this operand can only be selected from the D data register;
Len (data length): In bytes, one D register occupies 2 bytes, with the lower bits before the higher bits.
Mode (CRC Check Mode): Different types of CRC checks can be selected.
| Name | Number | Polynomial | Check Code Length |
|---|---|---|---|
| CRC-16 | K0 | X16+X15+X2+1 | 2 bytes |
| CRC-12 | K1 | X12+X11+X3+X2+X+1 | 2 bytes |
| CRC-8 | K2 | X8+X2+X+1 | 1 byte |
| CRC-CCITT | K3 | X16+X12+X5+1 | 2 bytes |
| CRC-32 | K4 | X32+X26+X23+X22+X16+X12+X11+X10+X8+X7+X5+X4+X2+X+1 | 4 bytes |
| CRC-32C | K5 | X32+X28+X27+X26+X25+X23+X22+X20+X19+X18+X14+X13+X11+X10+X9+X8+X6+1 | 4 bytes |
The computed checksum will follow at the end of the data.
For example, there is a data segment of 12 34 56 78 (hexadecimal) stored in registers starting with D0. So D0=0x3412, D1=0x7856, with a length of 4 bytes.
After executing CRC D0 K4 K0, the CRC checksum will be saved to D2, which is 0x107B.
Attention:
When the data length is odd, the checksum will immediately follow the high bit of the last register.
Please note that the input parameter is the byte length of the original data, and the length of the final communication data should be added with the length of the subsequent checksum.
1.2. The valid operands of the instruction
| Input/Output | Data Type | operand | Description |
|---|
1.3. Example
Instruction table:
NETWORK 000
LD M0
MOV H3412 D0
MOV H7856 D1
CRC D0 K4 K0
POP
图1 CRC