set slave number in Modbus context.
status = modbus_setSlave(mbc, slaveId) [status, ierr] = modbus_setSlave(mbc, slaveId)
The Modbus connection created with modbus_newTcp or modbus_newRtu.
The slave ID to assign (from 0 to 254). 255 is used for broadcast.
0 if connection was successful and -1 otherwise.
Erreur number.
This function sets the slave number in the Modbus connection context.
The behavior depends of network and the role of the device:
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.
The slave number is only required in TCP if the message must reach a device on a serial network. The special value 255 (0xFF) can be used in TCP mode to restore the default value.
The broadcast address is 255. This special value must be use when you want all Modbus devices of the network receive the request.
When called with one output argument, a Scilab error will occur when the setting fails. When called with two output arguments, no Scilab error will occur but ierr
will contain the internal modbus error number.