7.1.3 R_TRIG
Function
R_TRIG is called rising edge detection and is used for rising edge detection of variables or logical operation results.
LD graphics
Parameter description
| Interface variables | Declaration | Data type | Description |
|---|---|---|---|
| CLK | Var_Input | BOOL | The result of the current logical operation (input as Boolean signal) |
| Q | Var_Input | BOOL | The result of edge detection |
Corresponding syntax
- Detect the current CLK value and compare it with the last CLK value stored in the specified instance;
- The CLK value changes from FALSE to TRUE, and a rising edge of the signal is generated in the output Q. The value of the Q value output in one cycle is TRUE;
- In other cases, the signal output by this instruction is FALSE
warning
Function block usage requires global declaration of an instance
Example
- LD example is shown in the following animation:

- ST example is shown in the following code:
R_TRIG_1(CLK:=bVar,Q=>OUT);
IF OUT THEN
iVar:=IVar+1;
END_IF;