In automation, it’s often necessary to detect when a signal changes state, rather than its continuous value. For example:
- You may want to trigger an action once, when a button is first pressed.
- Or you may need to act only when a signal turns OFF, not while it’s held LOW.
For this purpose, TIA Portal provides standard function blocks:
- R_TRIG: Detects rising edge (FALSE → TRUE transition)
- F_TRIG: Detects falling edge (TRUE → FALSE transition)
R_TRIG – Rising Edge Detection
Function: Triggers TRUE for one scan cycle when the input transitionsfrom FALSE to TRUE.
Use Case:
You want to increment a counter only once when a push button is pressed, not while it is being held.

Create a new Function Block (FB) and prepare the structure

Call the FB to OB1 and map Input and Output
Explanation
- Every time the button goes from FALSE to TRUE, Edge_Rise.Q becomes TRUE only for one scan.
- So the counter increases only once per press, no matter how long the button is held.
F_TRIG – Falling Edge Detection
Function: Triggers TRUE for one scan cycle when the input transitions from TRUE to FALSE.
Use Case
You want to log an event or turn off a device right after a signal is lost.

Create a new Function Block (FB) and prepare the structure

Call the FB to OB1 and map Input and Output
Explanation
- When Sensor goes from TRUE to FALSE, Edge_Fall.Q becomes TRUE for one scan, setting the
Summury
| Function | Detects | Triggers On | Example Use Case |
| R_TRIG | Rising edge | FALSE → TRUE | Push button,start pulse |
| F_TRIG | Falling edge | TRUE → FALSE | Loss detection,stop action |
Good Practices
- Edge detection should always be used when triggering one-time actions based on state change.
- The edge blocks must be instantiated (like any FB) — this means you need to declare them as variables (e.g. Edge: R_TRIG).
- Multiple instances can be used if you need edge detection on multiple signals.
If you found this helpful, please consider supporting with a small donation. Thank you!
Leave a Reply