Jump to content

Modbus TCP Socket doesn't close, when I turn "Off" the Active Periodic bit.


Recommended Posts


I need to have several UniStream PLC's (Modbus Master TCP), that connect to a Modbus TCP Slave. The Slave provides Ambient Temperature, so reading the Holding Register from the Modbus TCP slave every 30 minutes or so, is adequate.

In UniLogic ladder logic, I set the Active Periodic bit "On" with a 30 minute timer, then it reads the holding register. After a successful update, I then turn "Off" the Active Periodic bit, but the PLC's socket connection does not close, and the Status of my Modbus Master remains at "1 = Good, No Errors" for the entire time in-between the 30 minute read from the Modbus Slave.

Can someone tell me how to close the Modbus TCP socket connection on port 502, using the UniLogic ladder logic.

Thanks, Tim S.


Link to comment
Share on other sites

  • MVP 2023

I don't think the Modbus table ever actually closes its connection, as you are observing.  I rooted through all the system bits and didn't see anything useful.

You may have to resort to doing your Modbus communications the hard way as in how it's done in Vision.  I've gone to using the Advanced Modbus Functions for my communications, as every aspect can be specified and multiple parallel sessions can be had.  See this post - 



Joe T.

Link to comment
Share on other sites

  • 2 weeks later...

Joe T., 

Thank you for the pointer. I had to move on to other projects, and I'm going to be getting back to this project soon. It appears that the Advanced Modbus Functions will give me what I need.


Your idea could work, however these PLC's will go into many sites, with a different number of PLC's, and possibly a different range of IP's, so setup would be more difficult. But if I can't get the socket to close using the Advanced Modbus Functions, then I may be forced to do something like you suggested.

Thanks guys,

Tim S.

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...