loop back and forth

bos06

Member
Join Date
Jun 2015
Location
Zwolle
Posts
4
I would love to have a counter with 8 different steps which will count up wit I0 and down with I1, once in mode up 7 is reached it should restart at 0 and once 0 is reached in mode down redirect to 8.

I have a Zen 20.
So far I have managed to create an upward loop which goes through 8 back to 0, but countdown only works until 0.

Any thoughts or ideas?
 
The people here on the forum like to see what you have created so far. Please zip and attach the .zen file. We will be glad to add to it or change it and give you some suggestions to develop a working solution.
 
I really don't think the Zen has the instruction capability to do the task you stated. Maybe some creative programming could be developed to do that. In the meantime why not consider using two upward Loops with one using the "Up" button I0 and the other using the "Down" button I1? Maybe this will accomplish the task needed unless you really need a displayed count. It would help to very clearly define your task at hand. Is this just a homework or classroom project, or, is it some real world need that must be accomplished using the Zen?
 
I'm not a zen user but if a counter won't do this maybe an "ADD" and "Subtract" instructions will.
 
I'm not a zen user but if a counter won't do this maybe an "ADD" and "Subtract" instructions will.
@Mickey,
I agree with you about the ADD and SUBTRACT instructions. I've looked for ADD and SUBTRACT instructions in this software but only see Inputs, Outputs, Timers, Counters, and Compare instructions. There is a free Demo version on MrPLC.com if you would like to look at the software.
See this link:
http://forums.mrplc.com/index.php?app=downloads&showfile=85
 
I would love to have a counter with 8 different steps which will count up wit I0 and down with I1, once in mode up 7 is reached it should restart at 0 and once 0 is reached in mode down redirect to 8.

I have a Zen 20.
So far I have managed to create an upward loop which goes through 8 back to 0, but countdown only works until 0.

Any thoughts or ideas?

Dang it, I hate to be the bearer of bad news, but... you can't. At least according to the manual.

However, what happens when the direction bit and the reset bit are on at the same time? My gut tells me it will still reset to 0, but there is a tiny chance that it would reset to the set value. At this point there's nothing to lose...:D
 
A counter with 8 different steps which will count up with I0, and then count down down with I1, ...
Check.
once in mode UP 7 is reached it should restart at 0...
When your Counter Value = 7 AND Counter Down bit is OFF, reset the counter to force it to restart at 0. Check.
. . . and once 0 is reached in mode DOWN, redirect to 8.
"Redirect" means to change direction (from DOWN to UP), then count up to 8. So when the DC0 (Direction Down) bit is ON, and Counter Value = 0, then turn OFF the RC0 Down bit. Check.

It is best to keep your questions in one thread, but see this old one:
http://www.plctalk.net/qanda/showthread.php?t=72797&page=2
 
Last edited:
Reading exactly what he says in both his posts, for the first pass, each time Input I0 UP Pushbutton goes on, counter counts 1 until it reaches 7, then resets to 0.

If I1 DOWN PB is pressed, counter changes direction and counts down until it hits 0. Then it "redirects" (changes direction again) and on the 2nd UP stage when I0 is pressed, counts up to 8. So the Counter must have a Preset of 8, and the comparison P bits are used to turn on Step bits from Counter = 0 up to Counter = 7. I used a 1st Pass M9 bit that gets sets when the first UP-then-DOWN pass reaches C0 = 0 while counting down.

But who knows what is the true problem? Usually beginners cannot do the problem because they do not understand it enough to describe it correctly.
 
Last edited:
so more info

Please have a look at the attachment

the idea behind this (real) project is to use 1 lever ( 3 positions, Load I0, neutral, unload I1) to select different options for 5 different outputs.

So we can choose from the following output options:
0 OFF
1 A
2 B
3 C
4 D
5 E
6 ABC
7 AC

During a single cycle the operator will have to go though different outputs and thus will have to switch quite often, for example from B to AC back to E.

If it is impossible to jump from A to AC, the operator will have to toggle a lot more.

So far I have managed to make it work in a single loop upwards 0-7-0-7
The downward counter stops at 0 which I can't change to value 7 unfortunately. So it only works 7-0.
 
I couldn't open your file (the Trial Version of the software only supports the 10C unit). Attached is a version that uses no counter to get what you are looking for. This one will be a 10C with an expansion module to get all the outputs. If you can't open the file, there is also a pdf version within the zip file.


The timer at the beginning is set up as a one-shot, to set/reset status bits when the program first runs. I set it to a .5 sec pulse, which is way more than needed, but it will let you see it in the simulator. Also, a reset contact was added to the same rung in case you want to wire in a reset button.

Most of the other rungs look at which input is on, which status bit is on, sets/resets whatever is needed, and then sets a "lock" bit. The lock keeps any further changes from happening to the status bits until both inputs are off.

The outputs are way down to the bottom.
 
Great program, Jordan.

The idea behind this (real) project is to use 1 lever ( 3 positions, Load I0, neutral, unload I1) to select different options for 5 different outputs.

Where is that 3-position lever and how does it relate to your 8 Output options?

It is becoming obvious that the real problem did not specify a counter, but probably 2 counters could be used to perform the moves, if you have to stick with that method.
 
Hello Lance,

The lever is on a control booth. With another lever we give hydraulic power in or out. The selection lever is made to work faster, saver and reduces space and distributes the oil to the selected outputs.

Thanks a lot for your input I'll test out tomorrow.
 

Similar Topics

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
4
Views
140
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
262
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
263
Hello All Could we get some expertise on flow control ? -Using a PID loop in Productivity 2000 with an analog output, How can we convert...
Replies
19
Views
1,563
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...
Replies
6
Views
1,067
Back
Top Bottom