Back to tutorials
PLC Instructions

PLC Programming Fundamentals – ONS One Shot Instruction

Vladimir Romanov
Table of Contents

Introduction of One Shot

The ONS, also known as the One Shot, instruction will allow the rung to execute once if the data leading to it is true. The instruction will not let the rung to evaluate again until the input is set back to LOW and then HIGH. The One Shot instruction is extremely useful when you need to execute a certain instruction once. A common example would be saving initial parameters of a process when it’s initialized. The ONS is found on the input side of a ladder logic rung structure.

What does the One Shot do in PLC Programming?

The One Shot Instruction's main purpose is to let the current through on the rising edge and execute the set of instructions placed after it for a single scan cycle. the first step is accomplished once a path is established to the ONS instruction and the bit is energized. Once that's the case, the following instructions will execute once. While the ONS remains energized, no other action will occur and the instructions following the ONS will not execute. However, if the ONS bit is de-energized and re-energized again, the steps above are repeated: the output instructions are executed once again.

PLC Scan Cycle

It is important to understand the PLC scan cycle as a PLC programmer as well as to work with certain instructions. A PLC scan cycle is the time it takes the PLC to scan every single logic command in the program. In case of ladder logic, it is the time it takes to execute every rung.

Due to their sequential nature, the PLC will scan one rung at a time. Once it completes the scan of a rung, it moves down to the next one. It will continue to do so until the entire program has been executed.

The One Shot Instruction will set itself to TRUE for one cycle of the PLC Scan. In other words, once it is set to TRUE, it will remain TRUE during a single execution of each rung. Therefore, it is possible to evaluate once any logic dependent on the ONS conditions.

Example & Usage of ONS

Here’s a real-world scenario of an ONS instruction:

  1. A Micrologix 1100 Allen Bradley PLC is used to control a process.
  2. The F8:0 register is used to read the temperature of the process.
  3. The F8:1 register is used to store the initial temperature of the process.
  4. A “Process Running” status is tied to I:0/0
  5. An ONS instruction is built using the B3:0/0 bit.
  6. The process is started and I:0/0 bit is set to HIGH.
  7. The ONS allows the MOV instruction to execute.
  8. The MOV instruction moves the contents of the F8:0 register to the F8:1 register.
  9. While the process is running, the MOV does not execute.

Programming example in RSLogix 500:

ONS One Shot Instruction RSLogix 500

The ONS instruction allows a single transfer of temperature when the process is initialized. Without an ONS, the temperature would keep transferring continuously.

Data Types Allowed for ONS

The ONS instruction will work with the following data types within the RSLogix 500 environment:

  • Boolean – The ONS does not evaluate the bit tied to it but does require a Boolean to work with.

Important Notes

  • Note 1 – The ONS instruction requires a non-input boolean bit to function. This bit should not be used anywhere else in the program.
  • Note 2 – The ONS instruction should only be used in cases where an instantaneous execution is required. It should not be used in conjunction with OTL and OTU instructions to create loops which could be avoided and simplified through simpler instructions.

Video Tutorial

Back to tutorials

Related Tutorials


PowerFlex 525 Parameter, Input and Output Programming Tutorial in RSLogix Studio 5000

The PowerFlex 525 series of Variable Frequency Drives from Allen Bradley is highly utilized and respected within the automation field. The drives are compact, versatile and easy to use. We’ve written an extensive tutorial on how to get started with these drives in a previous tutorial; it covers how to initialize the drive, connect it to an EtherNet/IP based PLC and how to set the right parameters. In this tutorial, we’re looking to expand on the concepts and demonstrate a way to access and utilize the multiple Input and Output options available on the drive. The reason you may want to utilize the IO is to save money on purchasing external components, integrate instrumentation into your drive and save floor space, wiring and cost. We’ve seen the need to integrate closely related sensors into a PowerFlex 525 application; this would be the right way to do it.

Vladimir Romanov

Publishing MQTT Data Using Opto 22 groov EPIC PAC

MQTT is a communication protocol that has taken off in the IIoT community. It’s a light-weight, efficient protocol that works through a publisher / broker / subscriber model. It creates an easy way for field devices to communicate and retrieve data from a single location. In this article, we’ll go over MQTT and dive into an example of how you can publish data using a groov EPIC PAC and retrieve the data using a MQTT client.

Vladimir Romanov

HMI Design - Best Practices for Effective HMI Screens

HMI Design is the practice of building HMI screens that are intuitive to the end user, pleasing to the eye and are efficient to operate. As control systems within manufacturing are migrated from traditional push button designs to primarily operated from HMI displays, HMI Design has become trivial to any new installation.Although there is a wide range of HMI based systems, the basic principles of good design remain the same. Different industries may dictate different patterns of layout for their systems, but the good practices remain.

Vladimir Romanov