Hardware circuit:

As shown in the figure below, two pieces of VisionFive 2 are selected as the Modbus-TCP master/slave devices respectively. The button that controls the blue/red led flashing is connected to %IX0.0 and %IX0.1 of the master device, the blue led is connected to %QX0.0 of the master device, and the red led is connected to %QX0.0 of the slave device, which is %QX100.0 of the master device. There is no electrical connection between the master and slave devices.

Figure 1. Connect to 40-Pin GPIO Header

Verification

When running as a Modbus-TCP slave, the slave device must run the default Blank Program:

Figure 2. Run Blank Program
Pasted image 20230221102645

After confirming the ladder diagram program to be launched by the main device and the configurations of the slave device is correct, click Start PLC to start the OpenPLC runtime. It can be seen that the prompt of successful Modbus-TCP device connection appears in the Runtime Logs:

Figure 3. Successful Connection

Then, press the button that controls the red led blinking and check whether the red light starts to blink to determine whether the master and slave devices communicate properly.