
I have seen a few posts lately on MODBUS so I thought I might post what I use with arduino. The library I use is located here: I have multiple slaves running. I use the code posted below on ALL of them, all I change is the slave ID. I keep all the pins the same, that way when I upload this code onto ANY arduino, it works. You should not have to change ANYTHING ELSE! I also have this running over Xbee's through a Digi Connectport X4, which converts it to TCP.
Then search for 'S7-200 Tips and Tricks' and download it; amongst many other options, this package contains program utilities for modbus slave communications on the S7-200. Hope this helps, Daniel Chartier. Using the Modbus Master Protocol Library (v1.2). With the Modbus Master Protocol instructions, you can configure the S7-200 to act as a Modbus RTU master device and communicate to one or more Modbus slave devices. Library) and the Modbus slave devices. Caution: Interconnecting equipment with different reference potentials can cause.
I then use Mango M2M as my SCADA package. I can now get my Analog and digital data from anywhere in the world, or open and close my roller doors, anything. I can even write Analog values. All my logic is done in Mango. You could probably do a mesh with a Xbee as a coordinator on a PC, transmitting to all the MODBUS slaves,(leave all destination addresses as zero's and set the slave Xbees to routers), but have not tried it because I have an X4 I DO NOT think you need to use RS485 for this. Just connect a PC straight up to your freshly programmed arduino, and run some sort of MODBUS master or test software, using the register number as listed in the code.
Remember, in the SCADA software do not use the whole address number, for instance, to access pin 2, you would be reading a COIL on Slave 1 at address 2, not address 10002. Some SCADA packages use ZERO offsets, so subtract 1, so the address for pin 2 would be 1. Sorry for the belated reply.
The code and library above is for Modbus RTU over RS485. It is just the Digi Connectport that converts the RTU to TCP. You should be able to use this code with ANY SCADA system or HARDWARE that supports STANDARD MODBUS RTU registers and addressing. Get an Arduino, ANY arduino. Load up the code as above. Add a RS-485 shield, and add a button to pin 2.
Get a PC, and load up SCADA/HMI software that supports MODBUS RTU. Connect a RS232 to 485 converter OR a USB to RS485 converter. Connect it to the Arduino shield. In the SCADA software, add a data source as Com port(USB-485), Baud rate(9600), Slave Number(As per arduino code) and a 'TAG' or 'point' as an 'Input status',address(try 1 or 2) 7. Go live with the SCADA software and press the button. It should be read in the software. Do the same with other arduino inputs, except for the data type.

MODBUS DATA types: (Yea, I know there are others, but these are all we need) Input status = Read a arduino input (1 or 0) Coil status = Write a arduino output (1 or 0) Input register = Read adruino analog input (0 to 1023) Use 2 byte unsigned integer in TAG settings Holding register = Write arduino analog output (0 to 255) Use 2 byte unsigned integer in TAG settings Remember, get rid of the RS-485 if you only have one slave!, it is used because 485 supports multidrop, this is where the slave ID's come in. You can do SO MUCH with MODBUS and ARDUINO. I have soil moisture, voltage, lux, temperature, humidity values all coming in flawlessly. I can open and close roller doors, lights on and off, set lights to a certain brightness.what next.imagine.