Jump to content

Networking 3 PLCs by MODBUS IP Ethernet

Recommended Posts

  • MVP 2023

I'm learning networking as fast as I can, but it's still a confusing subject for me. I've been able to successfully network 2 PLCs using MODBUS IP over ethernet, but now I need to add a third and can't seem to get it to work. Although I have a basic understanding of ports and sockets, I can't find the right combination to get everything talking. Can someone fill in the blanks with the proper or suggested values for each? Each PLC also needs to be able to communicate with a PC.

PLC1 Master PLC2 Slave0 PLC3 Slave1 PC

IP Address

Init Socket (PLC comm) Socket # ? Socket # ? Socket # ?

Port # ? Port # ? Port # ?

Init Socket (PC comm) Socket 1 Socket 1 Socket 1

Port #? Port # ? Port # ?

I get confused about whether the Socket # and Port # needs to be the same on each end of the communications path or must be different. Likewise whether the Socket # and Port # needs to be different between the two slave PLCs.

Thanks for your help.

Link to comment
Share on other sites

  • MVP 2023

Well, that didn't format very well, but I think I finally got it working. I was confused between local port and remote port. I also didn't realize at first that I needed two MODBUS IP Config FBs in the Master PLC.

While we're on this subject, any suggestions are welcome for a rock-solid routine that will detect and correct network problems automatically. What I'm doing is looking for a status message greater than zero and/or no change in transaction count for 2 sec. If either of these is seen, I close the socket, reinitialize the ethernet & socket, then re-connect the socket. This works pretty well, but I'm worried that I may be missing something important.


Link to comment
Share on other sites

Hi Flex727,

Unitronics Ethernet card supports 4 sockets.

According to your configuration you need to set in the master PLC two of the sockets to TCP master and one socket to TCP slave so that the PC will be able to connect it. (This will let the msater PLC to communicate with both slaves at the same time)

For both slaves you need to set 2 sockets which will be TCP slave so that the PLC and the PC will be able to connect to it at the same time.

Checking the status messages is good option. If you will reinitalize the Ethernet card then all the connections will be lost and you will need to reconnect both slaves. If you recognize communication problem then you can init the relvant socket.

Take a look also on SIs 103 - 106 (keep alive) for setting in the slave PLCs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...