Dear colleagues,
I'm new with Arduino and coding things. I have some background with PLC (Siemens, Allen-Bradley and etc) programming.
I have the following hardware:
- Arduino Mega 2560
- Ethernet Shield W5100
- External controller from Stanely (nutrunner controller)
External controller can act only as a slave on TCP/IP. Please find part of the manual for it reffered to Modbus attached.
I want to use Arduino as a MODBUS TCP/IP Master (IP 192.168.0.1). So that it should read the data from the slave controller Stanley (IP 192.168.0.2).
I found a standard library for Modbus (#include <ArduinoModbus.h>). I found the code in the internet trying to read one bit and write one bit from the Arduino to the slave. Please find code attached.
But this doesn't work. As I suppose the problem is in the code.
In my opinion Server should read the data from the slave using slave IP adress, because this slave don't have any field to put in the server IP.
But I don't found any information about slave IP in the code, neither in the library description. There is only accept client and nothing else.
How can I show to my Arduino that it should read the data from this particular IP slave.
Sorry for bad explanation. Feel free to ask questions if I miss something.
I guess this is a very common problem with Arduino and other slaves devices. Would be great if we can solve it together.
MODBUS_TCP.ino (2.65 KB)