modbus-esp8266 icon indicating copy to clipboard operation
modbus-esp8266 copied to clipboard

ModbusAPI::Hregs Does Not Compile

Open seikosantana opened this issue 1 year ago • 1 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

seikosantana avatar Feb 07 '24 04:02 seikosantana

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

emelianov avatar Apr 25 '24 18:04 emelianov