Jump to content

Recommended Posts

Hi!

I am having issues using the Protocol Scan TCP/IP function block and I was hoping someone could help me (I am a beginner visilogic/ladder logic user). I have already configured socket 0 and the Protocol Configuration to the correct IP address and it is configured correctly. I know this because the Protocol Send TCP/IP function block works. However, I cannot get the Protocol Scan TCP/IP function block to receive any messages.

What I am doing is sending Modbus commands to a non-PLC device using the Protocol Send TCP/IP function block and it works. But each of these Modbus commands also have a Modbus response, which I am trying to get using the Protocol Scan TCP/IP function block. I have tried placing the scan block directly after the send block and I have tried having the scan block after a constant set direct contact. I have tried scanning for the message I was looking for and I have tried scanning for any message at all. But all of these attempts did not change the  MB Message Received to a 1. Please help! Thank you!

Link to comment
Share on other sites

  • MVP 2023

Hi jsb, if you're swallowing food you can't take a breath at the same time!  The modbus blocks need to complete all they do following a trigger event, and usually this trigger will be one that comes on for a single scan...eg a rising edge.  "I have tried having the scan block after a constant set direct contact" will never work because you are calling the function every single scan, which doesn't let the plc go through the various processes involved.  Scan time is much quicker than all that is involved in modbus comms.  You need to call a function and give it time to finish off, which can be monitored using the elements selected during the configuration.  If your non-plc device sends a response immediately after receiving info, you may not be able to easily get it into the plc.

I would initially be setting up a program to simply do your protocol scan, and get that working properly.  Once you have that functioning you need to find how you can combine the 2 things.  You may need to end up doing the scan as a totally separate request, with appropriate buffer time in between.  Don't forget about buffers and innate response times.  Say you have 3 retries set at 500ms, then if there is an issue the plc needs to run through for a little over 1500ms before you can successfully go onto the next request.

cheers, Aus

  • Upvote 1
Link to comment
Share on other sites

  • MVP 2023
On 7/1/2019 at 5:47 PM, Ausman said:

if there is an issue the plc needs to run through for a little over 1500ms

True.

Just as an aside, I usually set my retries to 1.  If it ain't gonna talk on the first try, a lot of times it ain't gonna talk.

Joe T.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.