1 Star 0 Fork 0

NightBreeze/modbus-esp8266

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

FAQ

This library allows your Arduino board to communicate via Modbus protocol. The Modbus is a protocol used in industrial automation and also can be used in other areas, such as home automation.

The Modbus generally uses serial RS-485 as physical layer (then called Modbus Serial) and TCP/IP via Ethernet or WiFi (Modbus TCP and Modbus TCP Security).


Where to get documentation for the library?


Client work cycle diagram

Client diagram


Server work cycle diagram

Server diagram


How to send signed value (int16_t)?

How to send float or uint32_t values?

Modbus standard defines only two types of data: bit value and 16-bit value. All other datatypes should be sent as multiple 16-bit values.


Value not read after readCoil/readHreg/etc

The library is designed to execute calls async way. That is readHreg() function just sends read request to Modbus server device and exits. Responce is processed (as suun as it's arrive) by task(). task() is also async and exits if data hasn't arrive yet.


When calling readCoil/readHreg/writeHreg/etc multiple times only first of them executed


Transactional callback returns 0xE4 error

It's timeout error. Suggestions below are applicable to persistent errors or frequently errors. Rare timeout errors may be normal in some considerations.

ModbusRTU

Typically is indicates some kind of wiring or hardware problems.

  • Check wiring.
  • Check that baudrate settings are identical for client and server.
  • Try to reduce it to 9600bps.
  • Try to use different power source for Arduino device.
  • Try to replace RS-485 tranceiver.
  • If using Modbus simulator software on PC check the result with alternative software.

ModbusTCP

It maybe network problems. Use standard procedures as ping and firewall settings checks for diagnostics.


If it's possible to create ModbusTCP to ModbusRTU pass through bridge?

Some ideas to implement full functional brodge may be taken from this code. Very limited implementation is available in example.


Modbus Library for Arduino

ModbusRTU, ModbusTCP and ModbusTCP Security

(c)2021 Alexander Emelianov

The code in this repo is licensed under the BSD New License. See LICENSE.txt for more info.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/d__xin/modbus-esp8266.git
git@gitee.com:d__xin/modbus-esp8266.git
d__xin
modbus-esp8266
modbus-esp8266
master

搜索帮助