Introduction to the One Shot Instruction (ONS)
The ONS instruction is used to trigger an event. It allows logical continuity for one scan when the instruction is true. After this, the instruction goes false until it is shut off (reset).
The ONS instruction is commonly used with Latch/Unlatch instructions. When the latch instruction goes true, we might only want to hold it true for one scan. This way we can unlatch the bit at any time.
Imagine an alarm. When an alarm condition happens, it might latch an alarm horn. Even though the alarm condition is still present, the operator will want to shut off the alarm horm. When the operator acknowledges the alarm, we will unlatch the horn bit.
You will find the ONS instruction on the BIT tab of the instruction toolbar.
We will add the ONS before our latch instruction that we did in the last post, but first we will need to make a tag for this instruction. We will just name this tag “MyOneShot”. The data type of this tag will be BOOL. It only needs to be one bit, because the ONS will only store a 1 (if fired) or a 0 (if reset). To add this tag, go to the controller tag database, and choose “Edit Tags”. As long as the processor keyswitch is not locked into RUN mode, or we are offline, you will have a blank line to add the new tag.
ONS Logic
Next, we’ll add the ONS instruction before our latch as shown. Use “MyOneShot” as your tag name.
Now, let’s see what happens if button.0 goes true, and stays true.
Let’s energize button.1 at the same time button.0 is energized.
You will see that the bit is now in the unlatched state, but look what happens when we de-energize button.1, and button.0 is still energized:
To latch the bit again, we must shut off button.0, and re-energize button.0 for the latch to go true again.
— Ricky Bryce
To latch the bit again, wouldn’t you also have to reset the Oneshot?
In some of the other brands of processors, you would simulate a one shot instruction with a single bit, then unlatch the bit as soon as the rung goes true. However, with the ONS (PLC-5 or ControlLogix), or OSR (SLC-500), the one shot will reset itself when the conditions before the One Shot instruction go false. In this case, there is no need to manually reset the one shot instruction.