9 Function modules
9.6
Falling edge detection
This function module detects a falling edge (transition 1 -> 0) .
Call
F_TRIG<instance> (CLK);
Input
Parameter
<Instance>
CLK
Output
Parameter
Q
Comment
The operating principle of the function module corresponds to the following program code:
VAR CLK : BOOL; END_VAR
VAR Q : BOOL; END_VAR
VAR M : BOOL := TRUE; END_VAR
Q := NOT CLK AND NOT M;
M := NOT CLK;
The Q output remains at its Boolean value from one call until the next. It follows the transition of the input
signal (CLK) from "1" to "0" and returns to "0" the next time it is called.
Example with R_TRIG and F_TRIG
bool_in01
bool_out01
bool_out02
IF reset_flag THEN
bool_out01 := FALSE;
bool_out02 := FALSE;
END IF;
R_TRIG01 (bool_in01);
(
* detection of a rising edge at input bool_in01 *)
bool_out01 := R_TRIG01.Q;
(* short pulse at output bool_out01 for rising edge at input *)
58
Data type
Description
01 to xx (specify instance with two digits)
BOOL
Due to a falling edge (1 -> 0) at CLK, Q = TRUE
Data type
Query
BOOL
OUT := F_TRIG<instance>.Q;
t
t
t