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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reading uint32 holding registers

mauricemullens opened this issue · comments

Using the examples in TCP ESP32 i can't find an example to read multiple hreg in one call and receive an array back?
mb.readHreg(remote, REG, &res); is just giving me one value back, which is fine, but i tried using mb.readHreg(remote, 32260, &res, 2, NULL, 17), which should give me two uint16 values, but i only get one. So, how do i iterate? Or do i use another function?

Look here, modbus only works with 16 bit values, if you need to work with 32 bit values or more you must split those values.
Here are examples of how it can be done, both on the client side and on the server side.
Data Conversion

Here is the thread about this talk
##158