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
อ่านเพิ่มเติม
- สอนใช้ Modbus RS485 Master-Slaveคู่มือสอนการใช้งาน Modbus RS485 สำหรับ Samkoon PLC แบบ Master-Slave การเชื่อมต่อ PLC หลายตัว ตั้งค่า Communication Port และการสร้าง Modbus Table
- วิธีใช้ Modbus Poll กับ PLC FAs - การเชื่อมต่อและอ่านข้อมูลเรียนรู้การใช้งาน Modbus Poll กับ PLC FAs แบบละเอียด ตั้งแต่การเชื่อมต่อ TCP/IP การอ่าน Address Map การแก้ไข Illegal Data Address Error และเทคนิคการทดสอบ
- วิธีแก้ปัญหาการสื่อสาร Modbus บน PLC | ตรวจสอบสถานะเชื่อมต่อเรียนรู้วิธีแก้ปัญหาการสื่อสาร Modbus บน PLC ด้วย Status Code การตั้งค่าระบบแจ้งเตือน และเทคนิคแก้ไขปัญหาการเชื่อมต่อขาดหายในระบบอัตโนมัติ
- Modbus RTU Simulatorจำลอง Master/Slave ในเบราว์เซอร์ หรือต่อ PLC จริงผ่าน USB-RS485 · ≥ 1024 px

