RSLogix 5K - ONS vs OSR?

kdcui

Lifetime Supporting Member
Join Date
Dec 2007
Location
USA
Posts
386
I'm trying to determine the difference in functionality of the One-Shot (ONS) vs the One-Shot Rising (OSR) instruction in RSLogix5k.

When I set up both in a test program, they seems to achieve the same result, ONS taking up only one rung where OSR will require two. See attached image.

The instuctions are described as the following:

ONS
Structured text does not have an OTU instruction, but you can achieve the same results using an IF…THEN construct.

IF BOOL_expression AND NOT storage_bit THEN

<statement>;

END_IF;


When enabled and the storage bit is cleared, the ONS instruction enables the remainder of the rung. When disabled or when the storage bit is set, the ONS instruction disables the remainder of the rung.


You typically precede the ONS instruction with an input instruction because you scan the ONS instruction when it is enabled and when it is disabled for it to operate correctly. Once the ONS instruction is enabled, the rung-condition-in must go clear or the storage bit must be cleared for the ONS instruction to be enabled again.

OSR
When enabled and the storage bit is cleared, the OSR instruction sets the output bit. When enabled and the storage bit is set or when disabled, the OSR instruction clears the output bit.
There is more but I'm sure I don't need to paste it all. I can understand the OSR pretty easily, but I find the logic on the ONS confusing, especially when it seems to function similarly to OSR.

Can anyone explain? Thanks!

kcuions.JPG
 
The 'one rung' versus 'two rungs' is an 'apples to oranges' comparison. A more valid one is your rung 0 without the OTL instruction to rung number 1. Both produce a bit (test10 and test14 respectively) which will be on for one scan.

The ONS instruction is more compact if the one-shot effect is needed for that rung only (to set a latch in your example).

Both are similar if the needed effect is to produce the one-scan on bit and use the same number of bits. They're just in different positions on the rung.
 
Thanks for the reply.

In the example the OTL on Rung 0 does not output to Rung 1, they are different bits. I was manually toggling the test bit on Rung 0 and seeing if that would affect the OTL on that rung in the same way as the OSR on 1 was affecting the OTL on Rung 2; basically Rung 0 and Rungs 1-2 are separate form one another. Sorry, it was a quick and sloppy routine I threw toegether to play around with.

So besides being on different positions on the rung, how would they be used differently? I guess I am wondering if there are any situatations where I would want the one over the other?

Sorry if this might seem like an overly basic question, but I'm pretty new PLC programming.

Thanks again.
 
It's really just a matter of programming preference. Just remember the effect of each instruction.

I'm thinking that the presence of two instructions with virtually the same effect comes from the various previous type processors (the PLC2/5 family and the SLC/Micrologix family) and the ways they provided this function.

The ONS instruction is the more intuitive to me. The part of the rung after this instruction will be true only on the rising edge of the logic before this instruction.

The OSR instruction is just a box and, except for the name, doesn't give as visually obvious clue as to its effect - the second bit of this instruction will be true only on the rising edge of the logic into this box.

If a continuation of the one-shot output is not needed beyond the current rung then the ONS is the more obvious choice. It can be used, as in your rung 0 example, to do something immediately (set a Latch). But that 'rising edge on' logic output is not available past this rung. To make it so you need to add a bit which then makes it functionally equivalent to the OSR.

I standardized on the OSR just for continutity.
 
Re

I'm trying to determine the difference in functionality of the One-Shot (ONS) vs the One-Shot Rising (OSR) instruction in RSLogix5k.

When I set up both in a test program, they seems to achieve the same result, ONS taking up only one rung where OSR will require two. See attached image.

The instuctions are described as the following:



There is more but I'm sure I don't need to paste it all. I can understand the OSR pretty easily, but I find the logic on the ONS confusing, especially when it seems to function similarly to OSR.

Can anyone explain? Thanks!

kcuions.JPG



Can you please how to do the rising edge trough ST. You said trought the if statement but im not understanding how to get that storage bit.

Thanks!
 
Input_OneShot := Input1 and not Input1_old;

"Rest of code here where you might use the one shot"

Input1_Old := Input1;
 
OSR is so you can use a one shot on a sequential function chart or structured text as I believe the ONS is only available in ladder logic. Otherwise they function the same.
 
The OSR allows you to designate a rung specifically for generating a one shot bit with more conditional logic whose address can be used in multiple instances. Whereas the ONS is a single instance inline one shot bit which cannot be used in multiple locations that requires it to be in series with an output instruction on the rung. But fundamentally they both do trigger on a Rising Edge transition for one scan of the PLC until their preceding conditions are false.
 
OSR also directly and clearly exposes both the storage and output bits, and can be easily re-triggered by resetting the storage bit elsewhere in the program.
 
There is quite a difference between OSR and ONS, actually. I found out the hard way doing an online edit to a running PLC. Keep in mind, my background is primarily Siemens.

The problem came for me when I made changes to a program. When I wanted to add logic with a one-shot to a running PLC. I did an online edit, added a rung with an ONS, and it executed immediately while the logic was ON, and not when the logic input to the ONS went from OFF-to-ON, like I expected. When I used OSR, the execution only happened on the rising edge of the input.
 
Something quirky about the ONS instruction is that you can reference the tag in multiple instances, but only the first instance to "fire" will go true. Essentially the hidden storage bit is set for further instances. If you use OSR and reference the output bit in multiple rungs they will all be true for one scan.
 

Similar Topics

Hi guys, can anyone explain to me what is the difference between a one-shot and one-shot rising. I understand the ONS instruction but I don’t...
Replies
1
Views
8,822
Hello Friends I have a installation with v16, v17, v18, v19, v20. When I tried to open a v20 file, the enable source protection was not enabled...
Replies
1
Views
214
Hello all, I have the misfortune of needing to support some old firmware version 1756 controllogix machines in rslogix 5000, as well as some...
Replies
13
Views
652
Hi. I came into a problem that was buried in my memory. I had a list of modifications to do on 2 RSLogix programs. So I tapped in the IP...
Replies
7
Views
1,012
I am working for a client and currently installed on their computer studio 5000. they need to give me a backup file on their plc with rslogix 5000...
Replies
1
Views
405
Back
Top Bottom