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).
int16_t
)?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.
readCoil
/readHreg
/etcThe 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.
readCoil
/readHreg
/writeHreg
/etc multiple times only first of them executedIt's timeout error. Suggestions below are applicable to persistent errors or frequently errors. Rare timeout errors may be normal in some considerations.
Typically is indicates some kind of wiring or hardware problems.
It maybe network problems. Use standard procedures as ping
and firewall settings checks for diagnostics.
Some ideas to implement full functional brodge may be taken from this code. Very limited implementation is available in example.
(c)2021 Alexander Emelianov
The code in this repo is licensed under the BSD New License. See LICENSE.txt for more info.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。