modbus TCP set slave Id
nex2000 opened this issue · comments
I followed another post where it said to edit this line on the ModbusSettings file line 76.
uint8_t unit=1 // 255
I made this modification but nothing changes. I noticed that the ID can only be changed on push and pull functions. But unfortunately nothing to do even with these commands.
How can I change the slave address number.
Can I get an example ?
Thanks NEX
As far as I know the TCP slave ID is its IP address, unlike the RTU protocol.
Here is more information about it.
Does Slave ID field have significance in MODBUS TCP
https://www.modbustools.com/mbslave-user-manual.html#_connection
The library responds on any united when acting as ModbusTCP server.
For the client note last parameter for read\write calls:
uint16_t readCoil(IPAddress ip, uint16_t offset, bool* value, uint16_t numregs = 1, cbTransaction cb = nullptr, uint8_t uint = MODBUSIP_UNIT);