Rising edge trigger
The function block R_TRIG (rising edge trigger) allows you to recognize a rising edge at an input.
Input
signal input
detects rising edge for clock
Output
signal output
is set for each rising edge at the signal input CLK (clock)
The output Q of a function block R_TRIG remains set for a complete PLC cycle after the occurrence of a rising edge (status change FALSE -> TRUE) 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: R_TRIG;
signal_input: BOOL:=FALSE;
signal_output: BOOL:=FALSE;
END_VAR
Signal_output will be set, if a rising 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 := 4 ;
NETWORK_BODY
B(B_FB,R_TRIG!,copy_name,9,1,15,4,,?BCLK?AQ);
B(B_COIL,,signal_output,20,2,22,4,);
B(B_CONTACT,,signal_input,4,2,6,4,);
L(15,3,20,3);
L(1,3,4,3);
L(6,3,9,3);
L(1,0,1,4);
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:
CAL |
copy_name(CLK:=:=signal_input, Q:= signal_output) |