Why does this NOT re-cycle after delay

TheWaterboy

Lifetime Supporting Member + Moderator
Join Date
May 2006
Location
-27.9679796,153.419016
Posts
1,924
In the code below I have what should be, in its current condition, a simple cycling up counter with a delay before recycling.
But as it is shown it counts up only one time and then stalls. I must be missing something really obvious here.
Please tell me what it is.
Poll problem.jpg
 
reverse the order of the bottom two rungs.

always assume the PLC is doing exactly what you told it to do; what you want it to do, or expect it to do, or think it should do, is irrelevant. Therefore, we note the irony of your location as "State of Denial" ;); we've all been there; many times ;)

It is actually counting up more than once; it is counting up to 3 continuously, once per scan, as plvlce notes.
 
Last edited:
Assuming that the EnableStation bits are 0...

Once Station reaches 3 (ie >TotalStations), then each scan cycle your first rung shown MOVes 1 into Station (where your arrow is pointing). Since Station is now 1 and [Blur].EnableStation is 0, the second rung adds 1 to Station. Since Station is now 2 and [Blur].EnableStation is 0, the third rung adds 1 to Station. When the logic reaches the first rung in the following cycle, Station is 3 so the conditions for the timer are met and it does not reset.
 
It looks like on the first rung after a 2-second delay it sets the DN bit and moves "1" into Station. Then the second rung sees a "1" in Station and immediately increments it to "2". Then the third rung sees a "2" and immediately increments it to "3". All that happens in one scan once the DN is set.

That's what it looks like the logic is doing. So, your Station is probably going from 0 to 1 and holds there for two seconds, then jumps to three.

What are you trying to have happen here?

EDIT: Others typed that faster than I did :). And unless I am mistaken, reversing the order of the last two rungs would still have it immediately go from 1 to 2 without any delay. It would then move to 3 on the next scan. Again without any delay.

OG
 
Last edited:
Hey Bit,
Reversing the bottom 2 rung now creates counts from 2 to 3 and then pauses. so that's diagnostic, but why wont it count 0...1,2,3 repeat. That's the goal.
 
Hey Bit,
Reversing the bottom 2 rung now creates counts from 2 to 3 and then pauses. so that's diagnostic, but why wont it count 0...1,2,3 repeat. That's the goal.

Original is continuously counting 1,2,3... just all within the space of a single scan cycle.

EDIT: It's hard to help when we don't know exactly what your desired behaviour is. When do you want it to be pausing? Do you want it to go 1 PAUSE 2 PAUSE 3 PAUSE (repeat)?
 
Last edited:
Hey Bit,
Reversing the bottom 2 rung now creates counts from 2 to 3 and then pauses. so that's diagnostic, but why wont it count 0...1,2,3 repeat. That's the goal.

Oh, I assure you that station is counting from 1 to 2, then from 2 to to 3. you just never see the 1 because it is only at 1 for one scan.

Adding an [XIO PollCycleDelay.DN] before the original code might also work.

It looks like you want to

* poll, or at least assign a 1 to its blur.Poll, any station that is enabled i.e. has its blur.EnableStation with a value of 1, and continue polling that station for as long as its blur.EnableStation remains 1 (perhaps a poll assigns a 0 to its blur.EnableStation).
* When a station's blur.EnableStation is 0, move on to check the next station.
* after checking station 2 when its .EnableStation is 0, wait 2000ms.
 
Last edited:
The end goal is a driver for radio Polling. Each stations MSG and processing is its own program that performs an ADD when their read and write are completed.

The "enables" allow me to skip a station entirely if needed, otherwise if the MSG is going to fail it will hold the counter till it times out.

Opera: yes that what is supposed to happen, but the counter should reset once it reached 3.

PLVLCE: That sounds very plausible. How to get around that...
 
Hey Bit,
Reversing the bottom 2 rung now creates counts from 2 to 3 and then pauses. so that's diagnostic, but why wont it count 0...1,2,3 repeat. That's the goal.


You never start counting from 0... you recycle back to 1.

Increment the station number in one place per cycle. When you receive the feedback that the msg was sent and received a reply, move to the next. This is where an array with structs would look fancy and make the code simpler to write?
 
You need your rung with the timer to be false for at least 1 scan cycle immediately following your counter incrementing.


EDIT: What OG said
 
Last edited:
For a simple fix, how about just add XIO PollCycleDelay.DN before the timer?


EDIT: Beaten to it by drbitboy again I see.
 
OK I am pursuing the wrong idea then... under normal operation (EnableStation True) I want it to enable the series of x.poll bits in sequence.

The x.Poll bit is a public parameter of each program that enables MSG logic which would consume some scans. I see that trying to do this in a single ladder as a test appears to be impractical.
 

Similar Topics

L P#0.0 T MW 20 A m0.0 L mw 20 + 2 T mw20 Why not increase during the cycle?
Replies
2
Views
1,800
I am trying to connect with a Schneider plc which has a firmware version only available in Somachine v4.2. In Machine expert After taking upload...
Replies
0
Views
112
They are installed in a control panel that was made in France and are intended for the termination of analog inputs. Each of the red capped...
Replies
4
Views
418
So, I'm really just trying to get some experience by practicing with arrays. I'm using studio 5000 v33. I have one rung with an XIC bit that's...
Replies
5
Views
229
Back
Top Bottom