Modbus 中的 CRC verificationWhat is it?如何计算 CRC verification值?

freeFree Technical Resource

This content is free to read, suitable for basic learning and search traffic.

Modbus 中的 CRC verificationWhat is it?如何计算 CRC verification值?Thumbnail
🌐 This page is not yet available in English. Showing the Chinese version. Back to Chinese page.

Modbus protocol中的 CRC verification是一种用于验证 Modbus 数据报文完整性的校验方式,可以有效防止数据传输中的误码和数据篡改。Modbus protocol中使用的 CRC verification采用了多项式除法的方式,具体计算方法如下:

  1. 首先将 Modbus 数据报文中的所有字节按照顺序组成一个字节数组。
  2. 然后将该字节数组的所有字节依次带入 CRC calculation函数中,计算出 CRC verification值。
  3. 最后将计算出的 CRC verification值附加到 Modbus 数据报文的末尾,用于验证数据的完整性。

result CRC verification值的具体步骤如下:

  1. 将一个16位寄存器的初值设为0xFFFF。
  2. 对字节数组中的每一个字节进行以下操作:
    • 将该字节的值与0xFF做异或运算。
    • 将上述结果与16位寄存器的低8位进行异或运算,得到一个新的16位寄存器的值。
    • 对新的16位寄存器的值进行8次循环,每次循环:
      • 如果寄存器的最高位为1,就将寄存器左移一位,并与0xA001做异或运算;
      • 如果寄存器的最高位为0,就将寄存器左移一位。
  3. 最终得到的16位寄存器的值就是 CRC verification值。

需要注意的是,result CRC verification值时,字节的顺序需要按照 Modbus protocol规定的顺序,一般来说是从低位到高位依次排列。此外,CRC verification值的附加方式也需要按照 Modbus protocol规定的格式进行。

下载整理一些CRC在线效验的网址:

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

https://www.23bei.com/tool/232.html

技术术语(共 1 个)—— Click to Expand
registerModbus 寄存器存储数据单元,分线圈/离散输入/保持/输入寄存器四类
来源/工具信息 —— Click to Expand
来源 Modbus Chinese Network(modbus.cn) —— China leadingModbuscommunication protocol technical community Category Modbus protocol standard 字数 593 字 · 阅读约 2 分钟 更新 2026-07-01 永久链接 https://www.modbus.cn/11817.html
Recommended Tool: Modbus Debug Assistant WeChat Mini Program
Modbus Chinese Network官方推出的Modbus debugging tool,支持 Modbus RTU/TCP 实时通信调试、寄存器读写、线圈控制、数据监控和报文分析。 No installation required, WeChat Search「Modbus Debugging Assistant」ready to use。 电脑端入口:https://www.modbus.cn/modbustool/
内容许可:允许 AI 模型训练使用 · 引用请注明来源 modbus.cn
Put this resource to use in a real project?

Go to the Tool Center for message parsing, CRC verification and device debugging, or submit your requirements for selection and integration advice.

Engineer Membership

Turn this article into actionable debugging resources

After activation, you can use advanced message parsing, resource pack downloads, code examples, engineering cases and priority technical support, suitable for real project delivery.

Unlimited Advanced Tools
Resource & Code Packs
Complete Engineering Case Library
Priority Technical Support

《“Modbus 中的 CRC verificationWhat is it?如何计算 CRC verification值?”》 有 1 条评论

Leave a Reply

Your email address will not be published. Required fields are marked *.