Troubleshooting Looping Issue in Xinje PLC Programming

Question:

Hello, I am a beginner in ladder logic programming. I have successfully written a code for a machine I am working on using the Xinje PLC XC3-32RT-E. However, I am facing an issue where the program runs once and then stops, and I am having difficulty creating a loop in the program. If needed, I can share the code with you and provide more details about the machine. Could you please suggest a solution on how to proceed? Your help is greatly appreciated. Thank you in advance.

Top Replies

There are multiple ways to implement looping in a program, such as using a for-next loop or a conditional jump. Although I have not personally worked with this particular programmable logic controller (PLC), it appears to be very similar to Mitsubishi PLCs. However, upon reviewing the manual, I did not find the "break" instruction commonly found in Mitsubishi PLCs for exiting loops. In cases where the loop is variable, the CJ (conditional jump) function would need to be utilized. Additionally, I was unable to locate information on the Indirect address or index registers (referred to as Z in Mitsubishi), which allow for offsetting variable addresses and can be incremented. If possible, it would be helpful to share a pdf of the code for further analysis.

The Mitsi code provided does not seem to have a break function for variable for/next loops, nor does it show how to indirectly reference variables like Mitsi. Nevertheless, attached is some example code for reference.

Parky mentioned that they provided Mitsi code, but after a quick check of the manual, it wasn't clear if the for/next loop has a break function for variable loops. There was also confusion on how to indirectly point to variables like Mitsi. However, attached is some code that they use. Thank you, Parky, for your response. I truly appreciate it. Although I have managed to create a loop, I am facing another issue. But before discussing that, let me briefly explain my project. The purpose of this machine is to cut garment panels into two parts. The inputs and outputs are as follows: Inputs: X0 - Emergency X1 - Selector Switch X2 - Home (Proximity) Sensor X3 - Photo Electric Sensor 1 X4 - Photo Electric Sensor 2 X5 - Reed Switch Outputs: Y0 - Motor Pulse Y1 - Motor Direction Y2 - Pneumatic Cylinders Y3 - Scissor My program involves actuating the pneumatic cylinders to hold the garments and then cutting them. However, I am facing an issue with the loop functionality. It successfully moves the scissor forward and backward once, but fails to return in the second loop. All other functions work correctly. I suspect the issue lies in resetting the motor direction and pulses. Can you assist me with this issue? I have attached a PDF and the Xinje PLC program for reference. Thank you for your help.

In the motor control instructions for the Mitsubishi PLC, some differences can be observed compared to other models. For instance, the STOP function seems to be missing. The use of the STL function, which is essentially a flow, raises questions as it is not typically used in cyclic programs. To address this, I prefer using an integer variable like Seq_Number (D20) to execute each step in the ladder logic program. For example, let's consider a sequence breakdown: Seq. 0 = IDLE Seq. 10 = Start button pressed, waiting for part Seq. 20 = Part detected, clamping part Seq. 30 = Clamped part ready to move motor Seq. 40 = Motor moving forward Seq. 50 = Motor reaches position, stops Seq. 60 = Part stamping Seq. 70 = Returning motor Seq. 80 = Unclamping Seq. 90 = Unclamped, moving to Seq. 10 By incrementing steps in multiples of 10, flexibility is maintained for adding extra steps without disrupting the sequence flow. Additionally, utilizing symbols for memory bits and adding ladder comments can enhance the comprehensibility of the program for future reference. To illustrate the concept, consider a simple two-way traffic light system controlled by a sequence. While this example uses timers, a practical implementation would involve sensors and timers to transition between states efficiently. It is advisable to incorporate detailed documentation to facilitate understanding for others and future revisions.

In the discussion, tharinduk noted conflicting information regarding motor direction in the programming. The program indicates Y1 as the Motor Direction, while comments in the PDF point to Y6. This inconsistency makes it challenging to comprehend the interactions between contacts and coils throughout the program. @parky has proposed a more efficient approach by suggesting the use of integer steps for easier programming. Each output can be controlled independently on a single rung using a single coil based on the step number value. For example, specific actions like extending clamp cylinders or running the motor can be triggered at designated step numbers. This method allows for better organization of output control and logic maintenance, resulting in a clearer and more readable program structure. By utilizing integer step numbers and coils, the program becomes more streamlined and easier to manage compared to using SET and RST instructions for output control.

Hey there, glad you're getting your feet wet in ladder logic programming! It might be helpful if you shared your code, but off the top of my head, your issue could be related to your End instruction. If your End instruction is in the middle of your logic, the PLC will stop executing any instructions after this point. At the end of your logic program, try removing any Stop or Halt commands since they might be preventing your code from looping. Just remember, PLCs are naturally cyclic and execute your loop continuously anyways unless given a specific instruction to stop. Hope this helps and feel free to share more details, happy to assist.

Hey there! It sounds like you're on the right track with your ladder logic programming. One common reason your program could be stopping after a single run is that it might not have a proper loop set up or it's missing a condition to restart. To create a loop, try using a latch (like a SET instruction) that keeps a particular output active until it’s explicitly turned off. Make sure your conditions for restarting the process are met so it can keep cycling. If you share your code, I’d be happy to help pinpoint the exact issue! Feel free to provide more details about the machine too. Good luck!

Hi there! It's great to hear you're diving into ladder logic with the Xinje PLC! If your program runs once and then stops, it could be due to the way you've set up your conditions or the lack of a looping structure. You might want to look into using timers or counters to create a loop, or perhaps utilize some kind of latch that holds a condition true until a certain event occurs. Sharing your code would definitely help others understand your logic better and provide more specific advice. Don't get discouraged—it's all part of the learning process, and I'm sure you'll get the hang of it with some tweaks!

Hi there! It sounds like you're off to a great start with your ladder logic programming! If your program runs once and then stops, it might be due to logic that doesn't allow a continuous loop, such as missing a contact that would keep the program executing. Consider using a latch or bit memory that stays "set" during its operation to create a loop. If you can share your code, that would definitely help us pinpoint the issue more easily. Keep up the good work, and don't hesitate to ask for more help!

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: 1. Why does my Xinje PLC program run only once and then stop?

Answer: This issue could be related to the lack of a proper loop structure in your program. Without a loop, the program may execute only once and then halt. Ensure that your program contains a looping mechanism to keep it running continuously.

FAQ: 2. How can I create a loop in my Xinje PLC program?

Answer: To create a loop in ladder logic programming for Xinje PLC, you can use specific programming constructs like timers, counters, and jump instructions. By implementing these elements effectively, you can establish a loop that allows your program to run continuously.

FAQ: 3. Can you provide guidance on troubleshooting looping issues in Xinje PLC programming?

Answer: When troubleshooting looping problems in Xinje PLC programming, it's essential to check for errors in your ladder logic code that may be preventing the loop from functioning correctly. Additionally, verifying the scan cycle and ensuring proper program execution flow can help identify and resolve looping issues effectively.

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  â†’