Reset/set
The function block RS (reset/set) allows you to both reset and set an output.
Input
Set
The output Q1 is set for each rising edge at S if RESET is not set.
Reset
The output Q1 is reset for each rising edge at R1.
Output
set if a rising edge is detected at S and if R1 is not set
reset if a rising edge is detected at R1.
reset if a rising edge is detected at both inputs.
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: RS;
set: BOOL:=FALSE;
(*output_value is set for each
rising edge at set_input,
if reset_input is not set*)
reset: BOOL:=FALSE;
(*output_value is reset for each
rising edge at reset_input*)
signal_output: BOOL:=FALSE;
END_VAR
If set is set (status = TRUE) the signal_output will be set. If only reset is set, the signal_output will be reset (status = FALSE). If both set and reset are set, the signal_output will be reset to FALSE.
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,RS!,copy_name,9,1,14,5,,?BS?BR1?AQ1);
B(B_VAROUT,,signal_output,14,2,16,4,);
B(B_CONTACT,,set,3,1,5,3,);
B(B_CONTACT,,reset,3,3,5,5,);
L(1,2,3,2);
L(1,4,3,4);
L(1,0,1,5);
L(5,2,8,2);
L(8,2,8,3);
L(8,3,9,3);
L(5,4,9,4);
END_NETWORK_BODY
END_NET_WORK
END_BODY
copy_name( SET:= set, RESET:= reset);
signal_output:= signal_output;