Detecting a falling edge
The function block F_TRIG (falling edge trigger) allows you to recognize a falling edge at an input.
Input
signal input
detects falling edge for clock
Output
signal output
is set for each falling edge at the signal input CLK (clock)
The output Q of a function block F_TRIG remains set for a complete PLC cycle after the occurrence of a falling edge (status change TRUE -> FALSE) at the CLK input and is then reset in the following cycle.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
copy_name: F_TRIG;
signal_input: BOOL:=FALSE;
signal_output: BOOL:=FALSE;
END_VAR
Signal_output will be set, if a falling edge is detected at signal_input.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_FB,F_TRIG!,copy_name,9,1,15,4,,?BCLK?AQ);
B(B_CONTACT,,signal_input,4,2,6,4,);
B(B_COIL,,signal_output,19,2,21,4,);
L(1,3,4,3);
L(6,3,9,3);
L(15,3,19,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
copy_name( CLK:= signal_input ,
Q=> signal_output );
If you want to call the function block in an instruction list, enter the following: