jsb Posted July 1, 2019 Report Share Posted July 1, 2019 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! Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted July 1, 2019 MVP 2022 Report Share Posted July 1, 2019 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 1 Quote Link to comment Share on other sites More sharing options...
jsb Posted July 2, 2019 Author Report Share Posted July 2, 2019 Hi Aus! Thank you so much for your response! I got it working now, you're right. I just needed to add buffer time. Thanks! Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted July 3, 2019 MVP 2022 Report Share Posted July 3, 2019 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.