# CODESYS R_TRIG

Instructions · `R_TRIG` · verification: source checked

R_TRIG is a function block in the CODESYS Standard library that detects a rising edge of a boolean signal. A declared instance is called with the boolean signal to be checked connected to the CLK input. The Q output is TRUE when a rising edge is detected.

## Specification

| Property | Value |
|---|---|
| Language | iec 61131 3 |
| Code | R TRIG |
| Syntax | RTRIGInst(CLK := VarBOOL1); |
| Dialect | CODESYS |

### Parameters

| Name | Data type | Description |
|---|---|---|
| CLK | BOOL | Input: boolean signal to be checked |
| Q | BOOL | Output: TRUE: rising edge detected |

## Study notes

- R_TRIG is marked (FB), i.e. it is a function block, so an instance must be declared before use: RTRIGInst : R_TRIG;
- The instance is called in structured text as RTRIGInst(CLK := VarBOOL1); and the result is read from the Q output: VarBOOL2 := RTRIGInst.Q;
- The library page places R_TRIG under the Trigger category of the Standard library.

## Sources

1. [Beckhoff Information System](https://infosys.beckhoff.com/content/1033/tcplclib_tc2_standard/74391563.html) (accessed 2026-10-26)
2. [CODESYS Group](https://content.helpme-codesys.com/en/libs/Standard/Current/Trigger/R_TRIG.html) (accessed 2026-10-26)

---

Source page: https://machineschema.com/instruction/iec-r-trig  
JSON: https://machineschema.com/instruction/iec-r-trig.json  
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Cite Machine Schema and the original sources.
