Rising edge and one-shot in PLC ladder logic
A push button is held for hundreds of PLC scans. Often you want something to happen only once per press, at the moment it is pressed. That moment is the rising edge, and the instruction that detects it is called a one-shot.
The problem
A fault switch sets an alarm bit and an ACK button resets it. But while the fault is still present, the SET rung is true again on the very next scan, so the alarm comes straight back and ACK seems broken. The same problem appears when a button should add 1 to a value, or toggle a lamp: a plain contact is true on every scan of the press.
The rising edge
input ____/~~~~~~~~~~~~\____ edge ____|_______________ true for ONE scan, when 0 becomes 1
A rising-edge contact compares the bit with its value in the previous scan and is true only in the scan where it changes from 0 to 1. A falling edge does the opposite (1 to 0).
|--[ P FAULT ]--------------( S ALARM )--| |--[ ACK ]------------------( R ALARM )--|
Now only a new fault sets the alarm, and ACK works even while the fault is still there.
The instructions per brand
| Brand | Rising edge | Falling edge |
|---|---|---|
| Siemens | P contact, or the (P) coil / P_TRIG | N contact |
| Allen-Bradley | ONS after a contact, or OSR | OSF |
| Mitsubishi | LDP contact, PLS pulse coil | LDF, PLF |
| TOYOPUC | contact + rise differential with an edge relay (P000...) | fall differential |
Each one-shot instance needs its own memory bit for the previous state. In Allen-Bradley and TOYOPUC you give that bit explicitly; in Siemens and Mitsubishi it is handled for you.
Where you need it
- Toggle (push-on / push-off) with one button.
- Alarm memory that can be acknowledged while the fault remains.
- Counting by hand or adding to a value once per press. (A CTU counter already counts edges by itself.)
- Starting a sequence only once, even if START is held down.
A common trap
Do not use the same one-shot memory bit in two places, and do not put a one-shot inside a part of the program that is not scanned every cycle (for example a subroutine that is only called sometimes): it may miss the edge or fire again unexpectedly.
Try it: build the alarm example in the Playground with a plain contact, then with a rising edge, and watch the difference.
Watch it on the PLC Sim Lab channel
The alarm-that-comes-back problem and its one-shot fix, with a live ladder simulation. Open on YouTube → · More videos →
Try it yourself. Wire sensors, contactors and a PLC, write ladder logic and press RUN in the free PLC Sim Lab Playground. Nothing to install.
Open the Playground →Guided lessons →Frequently asked questions
What is a one-shot in a PLC?
An instruction that is true for exactly one scan when its input changes from 0 to 1 (rising edge) or from 1 to 0 (falling edge).
Do I need a one-shot for a counter?
Usually not: CTU and CTD counters already count only rising edges of their input. You need a one-shot when you add to a value with a math instruction.
What is the difference between ONS and OSR in Allen-Bradley?
ONS is an input instruction placed after conditions on a rung; OSR is an output instruction that sets an output bit for one scan. Both detect a rising edge using a storage bit.