IF OneShot in CLX Structured Text

dabomb4097

Member
Join Date
Feb 2012
Location
Chicago, IL
Posts
24
Hey all, I'm kind of new to structured text programming and I'm trying to understand why a routine someone else wrote doesn't quite work. There is a FOR statement nested inside an IF statement. The IF condition is a one shot, which only remains high for a single scan. Does an iterative FOR statement require more than one "scan" to run? Is it one scan per iteration or one scan for the entire FOR loop? The code block I'm having a problem with is something like this:

IF OneShot THEN
FOR x := 0 TO 24 DO
Count3[x] := Count2[x];
Count2[x] := Count1[x];
Count1[x] := 0;
END_FOR;
END_IF;

It only seems to perform the first copy on array element [0] and doesn't copy the rest of the array elements, so I think I have to hold OneShot on for multiple scans until the FOR Loop finishes? But I just wanted to check before I go changing a production program.

Thanks!
 

Similar Topics

Hi all, With ControlLogix, I know that we can do something similar to ONS in Strutured text, I cannot remember how to make. It is something like...
Replies
3
Views
1,557
Hi Guys! I'm writing a Function Block and I want an internal counter to reset at the call of this FB. Now I have searched at it seems I can't...
Replies
7
Views
3,612
How to I trigger on a positive transition oneshot in function block? In ladder I just use the |P| coil, but can't find anything similar in...
Replies
2
Views
4,426
I know Rockwell is trying to steer users into using multiple timed tasks instead of the old standby of having one continuous task as a way of...
Replies
13
Views
5,629
I have a quirky piece of ladder in RSLogix 5000 that is not acting the way I thought it should. I thought since a counter increments on a rising...
Replies
4
Views
1,935
Back
Top Bottom