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

ModbusAPI::Hregs Does Not Compile

seikosantana opened this issue · comments

I'm trying to put int32_t value into 2 registers with values from array for my ModbusRTU slave using ModbusRTU::Hregs

uint16_t weight_parts[2];
weight_parts[0] = static_cast<uint16_t>((weight >> 16) & 0xFFFF);
weight_parts[1] = static_cast<uint16_t>(weight & 0xFFFF);
_modbus.Hregs(HR_CURRENT_WEIGHT, weight_parts, 2);
return true;

but during compile it was unsuccessful:
Undefined reference to `Modbus::Reg(TAddress, unsigned short*, unsigned short)'

Am I using it incorrectly or is this intended?

Thanks in advance

_modbus.Hregs(HR_CURRENT_WEIGHT, (uint16_t*)weight_parts, 2);