OSR vs. ONS commands

mattw

Member
Join Date
Jul 2008
Location
Wisconsin
Posts
18
I have been reading this site with great interest for a couple months. This group is a pretty amazing resource. I have particularly enjoyed the Siemens versus AB discussion because we were all AB and Automation Direct, until we recently bought a plant with Siemens controllers (or the Siemens knock off VIPA controllers).



This being my first post here, I thought I’d introduce myself and give you some background so you have an idea where I’m coming from. For the last ten years I’ve worked with injection molding machines as a process engineer for a pretty small company. With a small company you have to pick up many skills.



One of my first jobs was getting an old used molding machine working that ran off a PLC-2. I muddled through the basics of ladder logic while troubleshooting the machine and getting it running. Later I went and took a pretty good semester long course in PLCs at the local community college so I got an idea of what it was I had done two years earlier.



In my previous job, I did some minor programming, making some minor changes to trim presses, adding some functions, had to add some expansion modules to Micrologix 1200 but that was the extent of my active programming experience. After getting laid off earlier in the year, I recently started a job with a fair bit of programming time and am now getting into the field in depth.



Now for my question. In RS Logix 500, what’s the difference between the OSR and ONS commands. Both are triggered by a false to true change in the condition. Both will reset only after the conditions go false. I can’t see any functional reason to choose one over the other.



I am writing a program and want to make sure I don’t commit some stupid error using the wrong one, but both commands seem to work when I simulate the program.



Thanks in advance.
 
Greetings mattw ...



and welcome to the forum ...



I'll assume (gosh I hate that word) that you're talking about the ONS instruction which RSLogix500 uses for the MicroLogix 1200 and MicroLogix 1500 systems ... and ... the OSR used for all of the other RSLogix500 platforms ... specifically, about the "in line" types of instructions that are used in the middle of various rungs ...



if so ...



the biggest difference between an ONS and an OSR is in the way the processors handle those instructions at "go-to-run" time ...



suppose that a switch in the field needs to control something in the program that needs to be "triggered" only ONE TIME when the switch is first turned ON ... sounds like perfect place for a "one shot" type device doesn't it? ... so let's try it both ways - with an ONS and with an OSR ...



suppose that the switch in the field is OFF while in "Run Mode" ... suppose that the processor is placed in the "Program Mode" ... suppose that while the processor is in the "Program Mode" the switch in the field is turned ON ... now suppose that the processor is put back in the "Run Mode" ...



with the OSR, the system WILL "trigger" the downstream logic ...

with the ONS, the system will NOT "trigger" the downstream logic ...



there's a hint why it works this way in the online help "book" for the ONS ...



Note: During pre-scan, the bit address is set to inhibit false triggering when the program scan begins. Rockwell Software 2005



secret handshake: the pre-scan operation does NOT affect the OSR instruction in an RSLogix500 application ...


now whether that difference in operation should be considered a "bug" or a "flaw" or a just an endearing "character trait" is highly debatable ... I'm not going into that ... I'm just answering your question - and telling you the difference between how the two things work ...



DISCLAIMER: I might have misunderstood what you're asking ... reason: usually you don't get to "choose" which instruction to use ... in most cases, the processor you're working with will only allow one type (OSR or ONS) - but not the other ... so if you're interested in RSLogix5 or RSLogix5000, or some other type of instruction, then please post again with more specific questions ...



hope this helps ...



PS Edit ...

when I simulate the program.


from that statement, I assume that you're using some type of "simulator" software - instead of an actual processor - to test out your programs ...



be careful with that - and ALWAYS retest and confirm that your program works correctly with a real-live processor - before using it in an actual industrial application ...



the reason:



there can be some differences in the way the simulator works when compared to an actual processor ... especially when it comes to things like switching back and forth between operation modes ...
 
Last edited:
The ONS is the PLC5 version of the OSR used in the SLC 5/0x processors. To muddy it up even more, the Micrologix 1200 and 1500 use the ONS as the inline instruction, and the OSR is a block instruction.

So, depending on which controller your are using, the two instructions might look completely different or nearly identical.

I usually use the inline version:

B3/999 or B3/999
-[ONS]--------[OSR]---

In this instruction, when the preceeding logic first goes true, the instruction sets its storage bit and is evaluated as true, passing "logic flow" to the rest of the rung. On the next scan, if the preceding logic is still true, the storage bit used by the ONS lets it know NOT it has already been true and will now be evaluated as false.

The block instructions OSR is an output instruction that uses two bits. It usees a storage bit just like the ONS, and uses a separate bit for the oneshot. The output bit will only be true for one scan upon each false to true transition of the rung. You then use this bit in other rungs as a oneshot.

I prefer using the inline ONS instruction over the OSR for readability, but you can do most oneshot functions with either instruction.

Hope this helps.
 
let me make sure that I know what we're talking about here ...

osr_ons.JPG


these are the two "inline" animals that I was discussing ...

osr.JPG


and this appears to be the "block" type OSR mentioned by my distinguished colleague OkiePC ...

regardless, just be sure to test your system under the "go-to-run" conditions that I mentioned earlier ... there ARE subtle differences in the operation of some of these things ...
 
Last edited:
Ron/Okie:



Thanks for the feedback. Ron you were right in your assumptions about what I meant (I applaud your ability to clearly understand my muddled thoughts).



After reading your post I checked the SLC instruction help and it did say that the ONS command is for Micrologix 1200 and 1500 while the OSR command is for all SLC and Micrologix 1000.



However, I kind of remembered trying both commands while writing the program. Since I wasn’t sure, I wrote three versions of the program; one with the ONS command, one with the OSR command and one with no one-shot as a baseline. The bit in question is turning on a timed output. I want to use a one shot because I don’t want the operator to ever hold the manual switch in and make the output stay on longer than the 0.15 seconds that I am allowing.



The PLC I’m using (Micrologix 1200 – 1762-L40BWAR) executes both OSR and ONS commands as one shots. So I guess I do have a choice. Thanks, Ron, for the explanation about the “go to run” differences. While it is not a very likely scenario, I should definitely go with the ONS command so that the output doesn’t accidently engage while making programming changes.

I didn't fully get your point about the "go to run condition" until I re-read your post after doing my test. I plan to try it later today.
 
The PLC I’m using ... executes both OSR and ONS commands as one shots. So I guess I do have a choice.



well, yes ... but remember that there are TWO types of "OSR" instructions ... one of those is an "in line" that goes in the middle of the rung ... the other is a "box type" that goes at the right end of the rung ... what I'm pretty sure that you can NOT do is this:



----[ONS]----[OSR]----



as far as I know, you can't use BOTH of those two "in line" instructions in the same processor ... that's what I meant when I said that you didn't have a choice in the matter ... in other words, I was ONLY talking about the "in line" type instructions ... I'm sorry that I wasn't more specific ...



The bit in question is turning on a timed output. I want to use a one shot because I don’t want the operator to ever hold the manual switch in and make the output stay on longer than the 0.15 seconds that I am allowing.



just as a suggestion, why don't you post the section of code that you're working on for this particular operation? ... unless I'm misunderstanding you, then you're going to have a hard time making any type of One-Shot meet those requirements ... (note that a One-Shot might certainly be a part of the solution - but there's probably going to be some more stuff involved too) ...



here are a couple of quick questions to help nail things down ...



(1) do you want to keep the output ON for a full 0.15 seconds - or is it OK for it to only be ON for just one processor scan of the program? ...



(2) suppose that the operator keeps repeatedly pressing and releasing and repressing the button very quickly ... could that defeat the 0.15 seconds that you're shooting for? ... (basically by "firing" and then "reloading" and then "refiring" the One-Shot over and over) ...



(3) after the maximum 0.15 seconds has expired, is there any requirement for something like a "cool down" period - during which another "firing" should not be allowed? ...



I don't mean to confuse you - so feel free to ignore all of this ... but if I were writing the program for you, these are the types of questions we'd have to answer before I could start putting in the rungs ...



again, I suggest that you post your program ... we'll be glad to take a look at it for you ...



good luck with your project ...
 
Last edited:
Ron:



I actually thought of that. I know that there’s no reason for the operator to continually push in the button, I made allowances for him/her doing just that. I have seen too many operators do strange stuff out of shear boredom to discount it.



I already have another timer in the code so that a new cycle can’t be initiated for 3 seconds.



Thanks again for your advice.
 
Here is how I do what I think you are describing. 0.15 seconds seems awfully short, but I assume you know that value to be adequate for the process or device you are controlling.

anti_tie_down.JPG
 

Similar Topics

We have a vendor that loves ONS logic. It does ok as long as things run as expected. Well we all no nothing runs as expected for very long. If the...
Replies
3
Views
1,341
Hello, Can someone give me a practical examples of OSR and ONS in real life ? I know how it works but i need to know where we use it. Thank you.
Replies
6
Views
2,174
Hi, I'm using studio 5000. I'm trying to figure out the difference between OSR and ONS. Any small ladder example with explanation? Thank you,
Replies
1
Views
1,469
For a Micrologix Instruction set, would you please tell me why to choose ONS vs OSR. Is there something that the ONS can do that the OSR cannot...
Replies
7
Views
6,497
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,843
Back
Top Bottom