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.
1. Get an Arduino, ANY arduino.
2. Load up the code as above.
3. Add a RS-485 shield, and add a button to pin 2.
4. Get a PC, and load up SCADA/HMI software that supports MODBUS RTU.
5. Connect a RS232 to 485 converter OR a USB to RS485 converter. Connect it to the Arduino shield.
6. 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. Hey presto! It should be read in the software.
8. 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.
As far as the Siemens PLC goes, you can't use arduino with it unless you use the arduino as a master, and I don't see the point.
H
PS If I have missed anything, I apologise