How do I loop an instruction set XX number of times using Click PLC?

NewGuy2024

Member
Join Date
Jan 2024
Location
Orange County CA
Posts
6
Complete noob here, using a Click C0-02DD1-D to run a test stand. Requirement is to turn on motor run for X seconds, turn off and dwell for X seconds, turn on motor run + reverse for X seconds, turn off and dwell for X seconds, repeat XX times then stop.



I have managed to create a working cascade of 4 timers followed by a counter, I cannot figure out how to loop back so it will run XX cycles. I can get it to work one cycle at a time by pressing a hard wired PB to X1.



Consecutively with the timers I need an output (Y3) and an analog voltage (AD1V) to be on throughout the full number of cycles.



I have the PLC in a test box right now with hard wired switches & indicator lights, I will be using a C-More HMI in the actual test stand.



Any help would be appreciated, this is the first of many test stands I want to automate, current (partial) program attached (.ckp).
 
Try using an integer to determine what step you're on. Then all you have to do is change it to the start of the sequence.

e.g.:

if step = 0 and blue_push_button set step = 1
if step = 1: run timer1
if step = 2: run timer2
if step = 3: run timer3
if step = 4: run timer4
if step = 5: increment counter

if timer1 done: set step = 2
if timer2 done: set step = 3
if timer3 done: set step = 4
if timer4 done: set step = 5
if counter done: set step = 0, else set step = 1

if step = 1: run motor
etc.
 
**EDIT - Beaten to it before I hit the post button :ROFLMAO:

If your sequence is always going to be the same then it seems like a state/step based routine would be a nice, clean way of doing it. That will also make troubleshooting and changing it later a bit easier.

Start by defining your States/Steps in simple terms:

0: Waiting to start
1: Clear count
2: Turn on motor fwd for X seconds
3: Turn off and dwell for X seconds
4: Turn on motor rev for X seconds
5: Turn off and dwell for X seconds
6: Increment count
7: If count is XX then go to 0 - Otherwise go to 2.

You could also combine some of these together and reduce the number of states.
 
Thanks for the quick reply Cheeseface - I have to admit I'm not sure what you mean with the steps. I have the 4 timed cycles running satisfactorily, I just need to repeat the sequence say 25 times. I am wondering if the timers should be in a drum that can then be run XX number of times.
 
You were pretty close, only needed one more branch:
Untitled.png
The CTD1 counter value is the "step" referred to by @CheeseFace and @Jeev.
 
There is more than one way to skin a cat: the attached image implements the 4s+4s+4s+3s cycle with one timer. Also, rungs 2-4 could be more or less replaced by a single Drum instruction.

Untitled.png
 

Similar Topics

Hello, Ive got a program where I frequently have to write 0's into every element of an array, at the moment Im using loops to do this...
Replies
5
Views
1,493
dear friends can anybody help me in understanding step7 instruction loop with a example. bye ragavi
Replies
3
Views
2,681
Hi, I'm quite new to Rockwell PLC and currently trying to implement the following if Sw1 then for i:=1 to 20 by 1 do xEnable := 1...
Replies
9
Views
369
Hi all, I'm connecting several 4-20mA sensors together in parallel (only one shown below) The enclosure is ABS plastic with metal backplate DAQ...
Replies
5
Views
274
I have always controlled servos in Rockwell motion using position loop. I have an application where one process will push against a servo...
Replies
3
Views
272
Back
Top Bottom