Skip to content

ONS — One-Shot Rising

Category
Bit
Type
Input (condition)
Availability
All platforms

ONS instruction block: a contact drawn with a P between the bars, on the storage tag ONS


ONS (One-Shot Rising) is a retentive input instruction that lets an event happen exactly once. When the rung conditions to its left go from false to true, ONS passes power for one scan; on the next scan it goes false again even though the conditions to its left are still true. It only becomes true again after those conditions have gone false and then true once more. Use ONS when something must happen once per event rather than once per scan: capture a value the moment a button is pressed, increment a counter on each press, or fire a message on a change of state. Do not put an ONS in front of a timer, counter, sequencer, shift, FIFO or LIFO instruction; those instructions already trigger on the rung’s false-to-true edge, and an ONS in series adds nothing. ONS is the Logix name for the SLC 500 OSR instruction; the behavior is the same.


Operand Type Format Valid Range Required Description
Storage bit BOOL or bit member Tag name or Tag.bit Any writable memory BOOL or INT/DINT bit member Yes Scan-to-scan memory for the instruction. It holds the state of the rung conditions from the previous scan so ONS can see the edge. It is not the one-shot output and does not show whether ONS is true. Give every ONS its own storage bit and reference it nowhere else. Never use a pin.

The storage bit starts at its power-up value (0 unless a literal was entered). If the rung conditions are already true on the first scan, ONS fires once on that scan.

ONS is false. The storage bit is written 0 so that the next true scan is seen as a rising edge.

ONS compares the rung conditions against the storage bit. If the storage bit is 0 (the conditions were false last scan), ONS is true for this scan. If the storage bit is 1 (the conditions were already true), ONS is false. In both cases the storage bit is then written 1.

Nothing special. The storage bit keeps its last value into the next scan.

Timing, scan by scan:

Scan Conditions left of ONS Storage bit before ONS output Storage bit after
1 0 0 0 0
2 1 0 1 1
3 1 1 0 1
4 1 1 0 1
5 0 1 0 0
6 1 0 1 1

Scenario: Each press of a pushbutton adds one to a running count. Without ONS, the ADD would run every scan the button is held and the count would race upward.

Tags:

  • CountBtn — Count Button, BOOL
  • CountBtnOS — one-shot storage for the count button, BOOL
  • Presses — number of presses, INT

Rung logic:

—|XIC CountBtn|—|ONS CountBtnOS|———[ADD Presses + 1 → Presses]———

Scan 1 — Button not pressed:

  • CountBtn = 0, the XIC does not conduct, ONS is false and clears CountBtnOS to 0
  • Presses = 0

Scan 2 — Button pressed:

  • CountBtn = 1, the XIC conducts. CountBtnOS was 0, so this is a rising edge: ONS is true for this scan and sets CountBtnOS = 1
  • ADD runs once: Presses = 1

Scan 3 — Button still held:

  • CountBtn = 1, the XIC conducts. CountBtnOS is already 1, so ONS is false
  • ADD does not run: Presses stays 1

Scan 4 — Button released:

  • CountBtn = 0, ONS is false and clears CountBtnOS to 0
  • Presses stays 1. The next press will add one more

Values before and after one press: Presses goes from 0 to 1 no matter how long the button is held.


  • OSF — One-Shot Falling (one scan when the conditions go true-to-false)
  • XIC — Examine If Closed (the usual condition in front of an ONS)
  • CTU — Count Up (already edge-triggered; needs no ONS)
  • OTE — Output Energize (pulses for one scan when driven through an ONS)
  • Bit Logic Instructions — Category index

ONS conditions the rung; it does not read its own bit. The edge ONS detects is the false-to-true transition of everything to its left. The storage bit is only where ONS remembers last scan’s rung state. An ONS with nothing to its left sees the rung as always true and fires once at start-up, never again.

The storage bit must be unique. Two one-shots sharing a storage bit corrupt each other’s edge memory, and any other instruction writing that bit breaks the one-shot. LadderIDE does not check this for you. Name storage bits so they cannot be mistaken for outputs, for example StartOS or CountBtnOS.

The pulse replaces the rung condition. Power flow to the right of ONS is the one-shot pulse, not the original condition. Instructions after the ONS see one true scan, then false, for as long as the condition stays true.

Already edge-triggered instructions. TON, TOF, RTO, TP, CTU, CTD, SQO, SQC, SQL, BSL, BSR, FFL, FFU, LFL, LFU and MSG act on the rung’s own false-to-true edge. Placing an ONS in front of one of them changes nothing except adding a bit to keep track of.

Where ONS may sit. ONS is a condition, so it goes to the left of the rung’s output instructions. It is allowed inside a parallel branch leg, where it one-shots the conditions on that leg.

Bit members: the storage bit may be an INT or DINT bit member such as Flags.3. The base word is updated when the bit changes.

Applies to LadderIDE >=1.2.2 · Last reviewed 2026-09-09 · Screenshots verified 2026-09-09