For Loops and One Shots

NHOutbacker

Member
Join Date
Sep 2004
Posts
1
I have a routine in RSLogix5000 (CLX controller) that controls a conveyor rail. I have multiple rails so rather than duplicate the programming rungs for each rail I created the tags as arrays and then call the routine in a FOR loop, using an incremental index to reference each rail, according to the tag array.

Some of the rungs employ a One-Shot instruction. So my question is this:

Does a oneshot reset itself on the next scan when the next scan is part of a FOR loop?
Main Routine
-----------------------------------------------|FOR |-
|Routine:LOOP|-
|Index: Index|-
|Start: 1|-
|Terminate: 2|-
|Increment: 1|-

LOOP Routine
---|X[Index]|----|ONS[Index]|---------------------(Y[Index])-

On the first loop of the routine:
X1 = 1
ONS1 = 1
Y1 = 1

Second loop
X2 = 0
ONS2 = 0
Y2 = 0
.
.
.
Then the loop is called again...
X1 = 1 (still)
ONS1 = ?

Does the output of the ONS instruction go to zero because, on the next execution of the FOR loop, X1 stayed at 1? Or is it reset when X2 is 0, thus making the instruction prior to the ONS go from true to false?

In otherwords, is the function of the ONS exclusively related to the instruction itself (and the preceding instructions on the rung) or the address of the instruction (and the preceding instructions when that address was last used)?

Have I confused anyone?
 
One shot will reset when an instruction in front of it goes false, thats why oneshots are always the last instruction before an output.
 
The oneshot needs to see the false state while active in order to reset. In the example you give ONS[1] will NOT retrigger since, while it was the active data, it did not see that X[1] was ever off.

I THINK this is how the oneshot is logically constucted:



X[INDEX] ONS[INDEX] Y[INDEX]
-|----| |--------|/|---------|-------( )---|-
| | |
| | |
| | ONS[INDEX] |
| |-------( )---|



I hope this helps.
Keith
 
I cannot be specific about ControlLogix, but my experience with other brands dictates unambiguous NO. Avoid using one-shots within loops, period.
 
ons

No, a oneshot must see a false to true transition. If x=1 then the ons remains the same. It is the transition that triggers the oneshot.

Bruce :)
 

Similar Topics

Hello this is my first post. Looking forward to being more involved in this community to learn and hopefully help others. Any help or guidance...
Replies
7
Views
778
Hello Everyone, I have about 135 controller PIDE loops that I need to add to my Studio 5000 and that means I will probably have to create about...
Replies
8
Views
1,905
Good morning, I am currently having a struggle of getting cascaded pide loops to work within studio 5000. I have read and followed all the...
Replies
5
Views
1,910
Hi all, I hope everyone is well, I am in need of something so simple, I have made a small program in SCL and want to monitor some loops in...
Replies
5
Views
4,385
Hi guys, I am using TwinCAT 3 and I have a laser sensor that sends me data in Array. At the beginning of the measurement I run reference scan...
Replies
6
Views
2,567
Back
Top Bottom