table of contents
MODBUS_SET_SLAVE(3) | Libmodbus Manual | MODBUS_SET_SLAVE(3) |
NAME¶
modbus_set_slave - set slave number in the contextSYNOPSIS¶
int modbus_set_slave(modbus_t *ctx, int slave );DESCRIPTION¶
The modbus_set_slave() function shall set the slave number in the libmodbus context.Define the slave ID of the remote device to
talk in master mode or set the internal slave ID in slave mode. According to
the protocol, a Modbus device must only accept message holing its slave number
or the special broadcast number.
TCP
The slave number is only required in TCP if
the message must reach a device on a serial network. The special value
MODBUS_TCP_SLAVE (0xFF) can be used in TCP mode to restore the default
value.
RETURN VALUE¶
The modbus_set_slave() function shall return 0 if successful. Otherwise it shall return -1 and set errno to one of the values defined below.ERRORS¶
EINVALThe slave number is invalid.
AUTHORS¶
The libmodbus documentation was written by Stéphane Raimbault < stephane.raimbault@gmail.com[1]>NOTES¶
- 1.
- stephane.raimbault@gmail.com
mailto:stephane.raimbault@gmail.com
05/26/2012 | libmodbus 3.0.3 |