前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【物联网设备端开发】Arduino IDE的ModbusRTU, ModbusTCP库

【物联网设备端开发】Arduino IDE的ModbusRTU, ModbusTCP库

作者头像
帐篷Li-物联网布道师
发布2024-03-20 08:32:57
1100
发布2024-03-20 08:32:57
举报

? 个人主页:帐篷Li ? 系列专栏:物联网设备端开发 ?? gitee地址:IOTDeviceSDK物联网设备端开发工具包 ??♂? 物联网设备上云提供开箱即用接入SDK,提供物联网设备端开发工具包

一、ModbusRTU, ModbusTCP and ModbusTCP Security

有关图书馆的使用详情,请查阅相关文档部分。

二、功能

  • 支持所有Arduino平台
  • 在多个实例的任意组合中运行
    • Modbus RTU 主站
    • Modbus RTU 从站
    • Modbus TCP 主站 支持 ESP8266/ESP32 和 Ethernet library
    • Modbus TCP 从站 支持 ESP8266/ESP32 和 Ethernet library
    • MODBUS/TCP Security 主站 (ESP8266)
    • MODBUS/TCP Security 从站 (ESP8266/ESP32)
  • 支持的Modbus功能码:
    • 0x01 - Read Coils
    • 0x02 - Read Input Status (Read Discrete Inputs)
    • 0x03 - Read Holding Registers
    • 0x04 - Read Input Registers
    • 0x05 - Write Single Coil
    • 0x06 - Write Single Register
    • 0x0F - Write Multiple Coils
    • 0x10 - Write Multiple Registers
    • 0x14 - Read File Record
    • 0x15 - Write File Record
    • 0x16 - Mask Write Register
    • 0x17 - Read/Write multiple registers
  • 支持的Modbus功能
  • 现实生活复杂例子
    • ESP8266/ESP32 通过 Modbus 更新固件
    • ModbusRTU to ModbusTCP bridge

三、注意

  1. 寄存器的偏移量是基于0的。所以在设置您的监督系统或测试软件时要小心。例如,在ScadaBR中,偏移量是基于0的,那么在库中配置为100的寄存器在ScadaBR中将被设置为100。另一方面,在CAS Modbus Scanner中,偏移量是基于1的,所以库中配置为100的寄存器在这个软件中应该是101。
  2. 基于MAX-485的RS-485收发器工作在至少115200的速率上,而XY-017/XY-485由于某种原因只工作在9600的速率上。

四、最近更新:

代码语言:javascript
复制
// 4.1.1
+ Protocol: Fix wrong error code responce on non-existent register
+ ModbusTCP: Fix potential memory leak
+ API: cbEnable/cbDisable functionality extended
+ ESP-IDF: CMakeList.txt added
+ Examples: TCP-to-RTU fixed

// 4.1.0
+ API: Raw Modbus frame processing functionality
+ ModbusRTU: Precise inter-frame interval control
+ Examples: True ModbusRTU to ModbusTCP Server bridge
+ Examples: ModbusRTU respond to multiple ID from single device
+ ModbusRTU: Add direction control pin for Stream
+ STL: Add Reg count limitation to vector limit of 4000 (for ESP8266 and ESP32)+ Settings: Added MODBUSIP_CONNECTION_TIMEOUT (ESP32 only)
+ Settings: Set MODBUSIP_MAX_CLIENTS = 8 for ESP32
+ ModbusTCP: Make using DNS names optional feature
+ ModbusRTU: Add separate RE/DE pins control optional feature
+ API: Drop support of Ethernet library v1
+ Examples: Teknic ClearCore ArduinoWrapper examples added
+ Examples: ModbusTCP to ModbusRTU example added
+ ModbusRTU: Flush extra delay optional feature

// 4.0.0
+ Support of all Arduino boards
+ ModbusTLS: ESP8266 Client/Server and ESP32 Client
+ ModbusTCP: ModbusEthernet - WizNet W5x00, ENC28J60 Ethernet library support
+ 0x14 - Read File Records function+ 0x15 - Write File Records function
+ Examples: FW update over Modbus fullfunctional example
+ 0x16 - Write Mask Register function+ Test: 0x16
+ 0x17 - Read/Write Registers function
+ ModbusRTU: ESP32 SoftwareSerial support+ Build with no STL dependency (switchable)
+ API: ModbusIP => ModbusTCP
+ API: Access control callback for individual Modbus function
+ API: Master/Slave => Client/Server according to [PRESS RELEASE](https://modbus.org/docs/Client-ServerPR-07-2020-final.docx.pdf)
+ Lot of code refacting and small fixes

五、路线图

代码语言:javascript
复制
// 4.2.0
- API: Alternative CRC calulation (reduced memory footprint)
- ModbusRTU: Static buffer allocation- Test: Frame accuracy to specefication
- Buffer/packet size limitation support
- Slave/Server: slavePDU use early exit by return where possible
- Master/Client: Check frame size against header data where possible
- Master/Client: Additional responce data validation
- Free global registers and callbacks on remove last Modbus instance
- Test: push/pull functions
- ModbusTCP: Refactor connect by dns name (using native implementation for ESP32 etc)

// 4.3.0
- ModbusTLS: ESP32 Server
- Test: TLS ESP32 Server
- Test: TLS ESP32 Client
- Examples: TLS Certificate test Role extension and Alt-Name
- Examples: TLS Add example explanation
- ModbusTCP: ModbusAsyncTCP
- API: Extend API to allow custom Modbus commands
- Examples: Basic file operations
- Examples: Revising

六、代码贡献

GitHub - emelianov/modbus-esp8266: Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.

a.m.emelianov@gmail.com

Original version:

GitHub - andresarmento/modbus-esp8266: A library that allows your ESP8266 to communicate via Modbus protocol, acting as a slave (master in development). Supports IP via wireless network (Modbus IP).

GitHub - andresarmento/modbus-arduino: A library that allows your Arduino to communicate via Modbus protocol, acting as a slave (master in development). Supports serial (RS-232, RS-485) and IP via Ethernet (Modbus IP).

prof (at) andresarmento (dot) com

本文参与?腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2024-03-10,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客?前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与?腾讯云自媒体分享计划? ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、ModbusRTU, ModbusTCP and ModbusTCP Security
  • 二、功能
  • 三、注意
  • 四、最近更新:
  • 五、路线图
  • 六、代码贡献
相关产品与服务
物联网
腾讯连连是腾讯云物联网全新商业品牌,它涵盖一站式物联网平台 IoT Explorer,连连官方微信小程序和配套的小程序 SDK、插件和开源 App,并整合腾讯云内优势产品能力,如大数据、音视频、AI等。同时,它打通腾讯系 C 端内容资源,如QQ音乐、微信支付、微保、微众银行、医疗健康等生态应用入口。提供覆盖“云-管-边-端”的物联网基础设施,面向“消费物联”和 “产业物联”两大赛道提供全方位的物联网产品和解决方案,助力企业高效实现数字化转型。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
http://www.vxiaotou.com