It's not very well documented for the slave but maybe that is because it only has two methods...
It looks like the slave library is contained in the same library as the master but with name
You can see in the .h it only has two public methods. One is
connfigure() and the other is
update(). see below an extract from the .h which explains what each method does.
mySlave = ModbusSlave485();
mySlave.configure(slave, baud, parity, txenpin);
//check for update from master
extract from .h
* configure(slave, baud, parity, txenpin)
* sets the communication parameters for of the serial line.
* slave: identification number of the slave in the Modbus network (1 to 127)
* baud: baudrate in bps (typical values 9600, 19200... 115200)
* parity: a single character sets the parity mode (character frame format):
* 'n' no parity (8N1); 'e' even parity (8E1), 'o' for odd parity (8O1).
* txenpin: arduino pin number that controls transmision/reception
* of an external half-duplex device (e.g. a RS485 interface chip).
* 0 or 1 disables this function (for a two-device network)
* >2 for point-to-multipoint topology (e.g. several arduinos)
void configure(unsigned char slave, long baud);
* update(regs, regs_size)
* checks if there is any valid request from the modbus master. If there is,
* performs the requested action
* regs: an array with the holding registers. They start at address 1 (master point of view)
* regs_size: total number of holding registers, i.e. the size of the array regs.
* returns: 0 if no request from master,
* NO_REPLY (-1) if no reply is sent to the master
* an exception code (1 to 4) in case of a modbus exceptions
* the number of bytes sent as reply ( > 4) if OK.
int update(int *regs, unsigned int regs_size);
myDevice = RS485();