Set, reset output
SET: When the execution conditions have been satisfied, the output is turned on, and the on status is retained.
RST: When the execution conditions have been satisfied, the output is turned off, and the off status is retained.
You can use flags with the same number as many times as you like with the SET and RST instructions. (Even if a total check is run, this is not handled as a syntax error.)
When the SET and RST instructions are used, the output changes with each step during processing of the operation.
To output a result while operation is still in progress, use a partial I/O update instruction (F143_IORF).
The output destination of a SET instruction is held even during the operation of an MC instruction.
The output destination of a SET instruction is reset when the mode is changed from RUN to PROG or when the power is turned off, except when a hold type internal flag is specified as the output destination.
Placing a DF instruction (or specifying a rising edge in LD) before the SET and RST instructions ensures that the instruction is only executed at a rising edge.
Flags can be turned off using the RST instruction.
Using the various flags with the SET and RST instructions does not result in double output.
It is not possible to specify a pulse flag (P) as the output destination for a SET or RST instruction.
Since addresses are assigned directly using FP addresses, no POU header is necessary.
In ladder diagram, specify a rising edge in the contact and SET or RESET in the coil:
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 3 ;
NETWORK_BODY
B(B_CONTACT,,X0,4,1,6,3,R);
B(B_COIL,,Y0,10,1,12,3,S);
L(6,2,10,2);
L(1,0,1,3);
L(1,2,4,2);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 3 ;
NETWORK_BODY
B(B_CONTACT,,X1,4,1,6,3,R);
B(B_COIL,,Y1,10,1,12,3,E);
L(1,2,4,2);
L(1,0,1,3);
L(6,2,10,2);
END_NETWORK_BODY
END_NET_WORK
END_BODY
(*TRUE and FALSE are assigned to Y0*)
IF DF(X0) THEN
Y0:= TRUE;
END_IF;
IF DF(X1) THEN
Y0:= FALSE;
END_IF;
In instruction list, S and R are used for SET and RESET: