Troubleshooting TCP Communication with MSG Instruction on PLC Logix5562S and Dobot Robot

Question:

Hello there! I am currently endeavoring to establish communication between a PLC Logix5562S, 1756-EN2T, and a Dobot Robot using TCP with the MSG instruction. I have successfully created a connection with a socket and am able to both send and receive messages. The Dobot Robot is programmed to transmit 1440 bytes of data every 200ms. However, I am encountering an issue with continuously reading using the ReadSocket function. Despite attempting to reset the MSG instruction, the problem persists. The only workaround I have found is to delete the socket and create a new one each time I wish to read a new message, but I am sure there must be a more efficient solution to this dilemma.

Top Replies

If you're unable to continually read using ReadSocket.Click, it's important to troubleshoot the issue further. Are you receiving an error message? If so, what is the error code? It's essential to confirm that there are no active socket Writes while attempting a Socket Read to ensure proper functionality. Additionally, consider checking for any service timeouts that may be affecting the process.

I am not encountering any errors while using the Dobot Robot TCP remote control. I have observed that certain bytes, such as those related to the timestamp, update their values without needing the socket to be reset. However, most bytes do not seem to update. For instance, when changing the robot state, a byte should reflect this change but remains unchanged. I am also running a SocketWrite on another port for sending commands, which I set up on a separate socket. Could this setup be causing the issue? The Dobot Robot TCP remote control operates by utilizing port 29999 for sending commands and port 30005 for reading the 1440 bytes of information it transmits every 200ms. I have configured the SocketRead with the "extended message" option. An additional problem I have noticed is that when I switch the Trigger[27] state to receive new messages, it starts receiving garbage data until I reset the socket. Adjusting the Timeout value did not have any effect. Do I need to trigger the SocketRead every time I wish to read information? If so, would setting up a timer to trigger it be necessary? I have attempted to trigger the SocketRead without success. If there is any information missing that could help diagnose the issue, please let me know.

Using Socket AOI is highly recommended over creating your own code from scratch.

Hey! It does sound like a minor hiccup in programming rather than a hardware issue. You might want to check if there's any form of buffer in the PLC where incoming data can get congested. Reading 1440 bytes every 200ms is quite frequent, so if there's a buffer and it's not getting cleared correctly, it could lead to issues like the ones you're experiencing. Perhaps try clearing the buffer after each read, or see if there's a way to increase the size of the buffer. If such a solution exists, it could potentially help in handling the high frequency data transmission effectively without having to delete the socket each time.

It sounds like you're dealing with a tricky issue here. Firstly, kudos for the workaround, that's clever! However, I understand it's not efficient. One possibility might be an issue with the buffer memory management of the socket - remember, it doesn't automatically clear after a read operation. You might want to manually clear it each time you read, to ensure that the previously read data doesn't interfere with the new data. Also, ensure that your PLC code execution time doesn't exceed the Dobot's data transmission frequency. Lastly, you could try implementing a queue data structure, with each new message enqueueing and your PLC simply dequeuing whenever it's ready for a new message. This approach may offer better control over the flow of data. Let us know if that helps!

It sounds like you've done a lot already, impressive work! Regarding your problem, it seems like a buffering issue could be at play. The buffer might be filling up, causing the read socket function to lose some packets. You could consider implementing a large enough buffer to account for the data transmission rate from the Dobot robot. Moreover, checking your TCP settings to ensure they're appropriately configured for your specific use case might be beneficial as well. Keep tweaking, I'm sure you're just a few adjustments away from a smoother process.

It seems like you've got a bit of a data management challenge on your hands! You're correct, continuously deleting and recreating the socket is not the most efficient method. It might be that the issue lies with how the PLC handles TCP connections. While the Logix5562S is great for processing large data sets instantly, it may struggle with managing a continuous stream of data coming at intervals as close as 200ms. One thing you could try is to modify the Dobot Robot’s programming to batch data packets together instead of sending them individually. This way, your ReadSocket function would have more time to process each batch before the next one comes in.

It sounds like you're making great progress with your PLC and Dobot integration! Instead of recreating the socket every time, have you tried implementing a loop that continuously reads incoming data while also checking for any errors? Sometimes, setting a timeout value for the ReadSocket function can help avoid blocking issues. Additionally, ensure that your MSG instruction's buffer is properly configured to handle the incoming data size. It might also be worth double-checking your communication settings on both the PLC and the Dobot to ensure they align. Good luck!

It sounds like you’re making great progress with the setup! Instead of recreating the socket each time, have you looked into implementing a state machine for your MSG instruction? That way, you can manage the connection more effectively and handle incoming messages without needing to reset everything. Also, double-check the read buffer size and ensure it aligns with the data being sent; sometimes, mismatched buffer sizes can cause issues with reading continuous data. Hope that helps!

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

To add a comment, please sign in or register if you haven't already..   

Frequently Asked Questions (FAQ)

FAQ: FAQs:

Answer: 1. How can I troubleshoot issues with continuously reading data using the MSG instruction in a PLC Logix5562S when communicating with a Dobot Robot over TCP? - Answer: One potential troubleshooting step could be to check the configuration settings of the MSG instruction to ensure it aligns with the data transmission rate of the Dobot Robot. Additionally, verifying the socket connection and resetting the MSG instruction may help resolve the issue.

FAQ: 2. Why am I experiencing difficulties with reading messages continuously using the ReadSocket function in my PLC Logix5562S setup with a Dobot Robot?

Answer: - Answer: The issue could be related to how the ReadSocket function is handling incoming data packets from the Dobot Robot. It is recommended to review the function's implementation and consider optimizing the reading process for smoother communication.

FAQ: 3. Is there a more efficient solution than deleting and recreating the socket each time to resolve the problem of continuously reading messages from the Dobot Robot in a PLC Logix5562S system?

Answer: - Answer: It is advisable to explore alternative approaches such as adjusting the communication settings, optimizing the MSG instruction parameters, or implementing error-handling mechanisms to enhance the efficiency of reading messages without the need for socket deletion and recreation.

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’