Skip to main content

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

Alt ​​text

Parameter description

Interface variablesDeclarationData typeDescription
CLKVar_InputBOOLThe result of the current logical operation (input as Boolean signal)
QVar_InputBOOLThe 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:

alt text

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