F_TRIG
 
Detector for a Falling Edge
VAR_INPUT
VAR_INPUT
CLK : BOOL; (* Signal to detect *)
END_VAR
VAR_OUTPUT
VAR_OUTPUT
Q : BOOL; (* Edge detected *)
END_VAR
VAR
M : BOOL;
END_VAR
The output Q and the help variable M will remain FALSE as long as the input variable CLK returns TRUE. As soon as CLK returns FALSE, Q will first return TRUE, then M will be set to TRUE. This means each time the function is called up, Q will return FALSE until CLK has a rising followed by a falling edge.
Requirements
Development environment  | Target system type  | PLC libraries to include  | 
|---|---|---|
TwinCAT Version >= 2.6.0  | PC or CX (x86)  | Standard.Lib  | 
TwinCAT Version >= 2.6.0  | BC (165)  | Standard.Lb6  | 
TwinCAT Version >= 2.9.0  | BCxx50 or BX  | Standard.lbx  | 
TwinCAT Version >= 2.10.0 Build >= 1301  | CX (ARM)  | Standard.lib  |