How to connect two siemens PLC using Modbus Tcp_ip?

Let’s look at into, How two PLCs are connect using Modbus Tcp_ip. To connect devices, put one system as a server and other as client.

On the Project tree section, you will have your two PLCs, client and the server.

From the project tree > select Server > program block > main Now you will have instruction block from the server as shown in above.

The block contains input and output side If you want to know which data type is required to configure both sides.
Press on the block > press f1. A new window appears.

Now you have the description for the MB_server. Read the description check for the parameter requirements.

On the description window appears, select > connection > you can see start value to be set for connection type, note it.

Correct the value in the network logic by reading the description.

Check the value from, Device > server > program block > server data.

Do the similar procedure for the remote address. From the description, it says that put the IP address 0000 for remote address, if the server connects to accept the connection request.

At the bottom of the blocks, you can see the active establishments correct the value on it, after reading the descriptions.

Now take the client block from the devices.

Assign the request and enable bits. And there is the Mode bit. If we set the Mode bit to 1, your client can send data. If the Mode bit is set to be zero then, your client can only receive data.

As done in the server block, read the description and set the address block, IP address, active establishment everything. And now the configuration is ready.

Now you can check the blocks, both server block and the client block, if there is an error the error bit will become high. Status bit shows which line is an error in the program, So that we can easily identify the error.