Hi you have to make some change in the library by your self for arduino-modbus-slave library in the fowling link I added the control pin for the main function to become like this
//void modbusSlave::run(void)
void modbusSlave::run(int SSerialTxControlPin)
so now whenever you want use the RS485 you have to control it the code I made is like this
//****************************************************************************************
#define SSerialTxControl 2 //RS485 Direction control
#define RS485Transmit HIGH
#define RS485Receive LOW
digitalWrite(SSerialTxControlPin, RS485Transmit); // Enable RS485 Transmit
for(i = 0 ; i < _len ; i++)
{
Serial1.write(_msg
);
Serial.write(_msg);
}
delay(10);
digitalWrite(SSerialTxControlPin, RS485Receive); // Disable RS485 Transmit
//****************************************************************************************
https://code.google.com/p/arduino-modbus-slave/