Troubleshooting Serial Communication Setup for Lakeshore 218 Temperature Controller on Beckhoff CX5130 PLC

Question:

Hello, I am new to PLC programming and seeking assistance with setting up communication between my Beckhoff CX5130 PLC, EL6002 module, and Lakeshore 218 temperature controller. I previously used Python on my laptop to communicate with the Lakeshore, but now I want to establish this communication through the PLC. I have a program that attempts to ping the Lakeshore, but I am experiencing difficulties as the Timer.Q condition never seems to evaluate to True, despite monitoring it through logging. Additionally, I have encountered issues with setting up a COM port in TwinCAT, causing it to be disabled. Below is the code snippet for communicating with the Lakeshore and controlling the EL6002 module: Timer(IN:=TRUE); IF Timer.Q THEN Timer(IN:=FALSE); (* reset timer *) [Background Communication Code] END_IF fbEL6002Ctrl( Mode:= SERIALLINEMODE_EL6_22B, pComIn:= ADR(stInEL6002), pComOut:= ADR(stOutEL6002), SizeComIn:= SIZEOF(stInEL6002), [Additional Parameters] ); If fbEL6002Ctrl.Error = TRUE Then [Error Handling] endif I would appreciate any guidance on resolving these issues with communication and setting up the COM port in TwinCAT. Thank you for your help.

Top Replies

Utilizing a timer multiple times within a program is typically unnecessary. A more efficient approach involves using the code snippet:Timer(IN:=NOT Timer.Q) IF Timer.Q is True, execute the desired actions, ensuring no additional calls to the timer are made. It may be necessary to adjust the syntax to QTimer(IN:=NOT QTimer, OUT=>QTimer) on certain PLC brands. It is possible that in your code, the value of Timer.Q appears to be True briefly but is not sustained beyond a single scan cycle, resulting in it seemingly never being True.

Thank you for your help! I have successfully made the necessary changes and observed that the IF loop condition now evaluates to true. However, upon the initial startup process (logging in and clicking start), I am only seeing the Rx/Tx light flash once instead of constantly as data should be streaming through. Upon closer inspection, I have noticed that the variable BUSY in fbSend always remains false and there is no data attached to fbReceive. It is also puzzling to me that Timer.Q activates every 0.5 seconds even though fbReceive has a timeout of 1 second. I would expect Timer.Q to activate every 1.5 seconds if no data is being streamed. Do you have any suggestions on how I can determine if the data is actually being sent? Is there a way to monitor the contents of the buffers in real-time? @drbitboy.

The Timer expires every 0.5 seconds based on the provided example statement. During each scan cycle, the timer's behavior is mainly determined by its input parameter, which is the opposite of its previous timing completion state (not Timer.Q). If the timer had not expired in the previous scan cycle, Timer.Q's value in the current scan cycle is False. Therefore, the timer will start or continue running, potentially setting Timer.Q to True if it expires in the current scan cycle, or keeping it False if it does not. On the other hand, if the timer had expired in the previous scan cycle, Timer.Q's value in the current scan cycle is True. In this case, the timer will be reset, setting Timer.Q to False in the current scan cycle to restart on the next scan cycle. To introduce a delay after the timer expires and triggers fbSend, you can utilize the .bBusy, .Error, or .bStringReceived outputs of fbSend and fbReceive. The timing of events is crucial in programming, as illustrated by scenarios where delays are necessary after specific events occur. By integrating these cases into the Timer code, you can control the timing of actions more effectively. Please note that the suggested integration may not cover all potential scenarios, but it serves to prompt considerations of timing in programming over focusing solely on the actions themselves.

Apologies for any confusion in my earlier message. While I have successfully set the timing for triggering when needed, I am unsure if the serial communication aspect is functioning correctly. I suspect there may be issues with the communication port settings or data transmission. How can I troubleshoot this issue? Is there a method to adjust the serial port configuration or monitor the data exchanges?

Apologies for the lack of clarity earlier. While I have the timing of the trigger set correctly, I am unsure if the serial communication aspect is functioning properly. I am unsure if the communication port settings are correct or if my data is being transmitted/received accurately. How can I troubleshoot this issue? Is there a method to adjust the settings of the serial port or monitor the data transfer process? You may consider searching for "serial tap" or "hardware sniffer" for assistance. If the communication uses RS-485 and you are skilled with wiring, it may be possible to create your own solution.

Welcome to the world of PLC programming! It sounds like you're on the right track, but let's address a few possible issues. First, make sure your Timer is properly initialized and that you're not resetting it too quickly before it has a chance to evaluate – you might want to add a small delay to see if that helps. Regarding the COM port, double-check that the port settings in TwinCAT match those configured on your Lakeshore 218, including baud rate and parity. It’s also worth checking if the correct drivers are installed for your communication hardware. Sometimes, restarting the TwinCAT environment can help recognize any new configurations or changes. Good luck, and feel free to share updates or ask for more specific troubleshooting steps as you progress!

It sounds like you're off to a good start with your setup! For the Timer not triggering, check if your timer’s preset time is set correctly; it might be expiring before the conditions to evaluate Timer.Q are met. As for the COM port issues in TwinCAT, ensure that the COM port is properly configured in the I/O mapping and is free from other applications accessing it. Sometimes restarting TwinCAT can help it recognize the COM port correctly. Don't forget to double-check the baud rate and parameters match those of the Lakeshore 218 device too. Good luck, and don't hesitate to share more details if the issues persist!

Welcome to the world of PLC programming! It sounds like you're tackling quite a project. For your Timer issue, double-check your Timer initialization; it needs to be started correctly for it to evaluate to `TRUE`. Also, ensure that your PLC’s scan cycle isn't too fast, as it can affect Timer operations. Regarding the COM port in TwinCAT, make sure the port is properly configured in the System Manager and that you have the right permissions set. Sometimes, it helps to restart TwinCAT or even your whole PC to reset COM port statuses. Lastly, consider using logging to debug your communication: check if the Lakeshore is accessible from the PLC's network. Good luck, and feel free to share more if you're still running into issues!

Hey there! It sounds like you’re diving into an exciting project with your PLC and temperature controller. For your Timer issue, ensure it’s initialized properly before using it in your conditional logic; it might be worth checking if the Timer is running or if any settings have been misconfigured. Regarding the COM port, I've found that sometimes restarting TwinCAT or checking the device manager for port conflicts can help. Also, make sure your EL6002 is properly set up before trying to communicate with it. Don’t hesitate to share the specifics of your setup if you need more targeted help! Good luck with your project!

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.

You must be a registered user to add a comment. If you've already registered,
sign in. Otherwise, register and sign in.

Frequently Asked Questions (FAQ)

FAQ: 1. Why is the Timer.Q condition not evaluating to True in the program attempting to ping the Lakeshore?

Answer: Answer: The Timer.Q condition not evaluating to True could be due to potential issues within the program logic or the setup of the timer itself. Check for any errors in the timer configuration or the conditions that trigger its activation.

FAQ: 2. How can I resolve the issues with setting up a COM port in TwinCAT for communication with the Lakeshore 218 temperature controller?

Answer: Answer: To resolve the COM port setup issues in TwinCAT, ensure that the correct COM port configuration settings are selected, such as baud rate, parity, data bits, stop bits, and flow control. Verify that the COM port is enabled and compatible with the communication requirements of the Lakeshore 218 temperature controller.

FAQ: 3. What steps can I take to troubleshoot communication problems between the Beckhoff CX5130 PLC, EL6002 module, and Lakeshore 218 temperature controller?

Answer: Answer: To troubleshoot communication issues, check the wiring connections between the devices, confirm the communication protocols and settings are correctly configured, verify the addressing and data format compatibility, and ensure that the PLC program logic aligns with the communication requirements of the Lakeshore 218 temperature controller. Additionally, monitor error codes or messages to pinpoint the source of communication failures.

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  →