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

FunctionDetectsTriggers OnExample Use Case
R_TRIGRising edgeFALSE → TRUEPush button,start pulse
F_TRIGFalling edgeTRUE → FALSELoss 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!

Posted in

One response to “TIA Portal Tutorial: Edge Detection – R_TRIG and F_TRIG”

Leave a Reply

Discover more from PLC Steps - Your Guide to Industrial Automation

Subscribe now to keep reading and get access to the full archive.

Continue reading