The Modbus slave from the FAQ Modbus Communikation Master/Slave via Ethernet is used here.
- Create a "Standard project" and select CODESYS Control Win V3 as the device.
- Define the target system by means of the Netzwork scan.
Insert an Ethernet adapter in the device tree and specify the interface to be used.
If a target system is not defined yet, then the error message "Gateway not configured" is displayed.
- Insert a Modbus TCP Master below the Ethernet adapter in the device tree.
Insert a Modbus TCP Slave below the Modbus TCP Master in the device tree.
Pay attention that the address is the the same as for the Modbus Slave Device.
Adapt the POU PLC_PRG as follows:
- After starting the project, a connection cannot be established.
- Set the variable xUpdate to TRUE so that the new IP address is passed.
Resetting to an invalid IP address is not possible.
The Modbus component has to be deactivated first.
This is done by means of the "Enable" property which is available only after activating the device diagnostics.