The problem here is I can't read any register, 'holdingRegisterRead' is always return '-1' which means unsuccessful.Ĭode: #include // ArduinoModbus depends on the ArduinoRS485 libraryīyte mac = // Ethernet MAC Address After that the arduino is successfully connected and I can ping it from the laptop and also I have received successful connection serial messages through my Serial Monitor. Then I connected my Arduino & Ethernet shield and I gave them IP matching with the network, First I couldn't connect then I had to change the port speed from 100Mbps to 10Mbps. įirst, I have done a little modification to example code below Then connect my arduino and my laptop to a switch and tested it with modbus simulator (Modbus Slave program from and I succeeded to write & ReadĪfter that I Connected my Laptop to a EKI-7659C Industrial switch which is connected to the Allen-Bradely PLC and also I was able to read registers through the modbus simulator I'm trying to implement Modbus Master using my Arduino Mega & Ethernet Shield then connect it to Allen-Bradely PLC.