ExST assignment R=
If the operand of the reset assignment switches to TRUE, the assignment causes the variable to the left of the operator to be assigned a FALSE. The variable is reset.
Syntax:
<variable name> R= <operand name> ;
The variable and the operand have the data type BOOL.
Sample:
PROGRAM MAIN
VAR
bOperand : BOOL := FALSE;
bResetVariable : BOOL := TRUE;
END_VAR
bResetVariable R= bOperand;
If the operand bOperand switches from FALSE to TRUE, the variable bResetVariable is assigned a FALSE. But then the variable keeps its state even if the operand keeps changing its state.
Multiple assignments
In the case of multiple assignments within a code line, the individual assignments are not processed from right to left, but all assignments refer to the operand at the end of the code line. |
Sample:
FUNCTION F_Sample: BOOL
VAR_INPUT
bIn : BOOL;
END_VAR
IF bIn = TRUE THEN
F_Sample := TRUE;
RETURN;
END_IF
PROGRAM MAIN
VAR
bSetVariable : BOOL;
bResetVariable : BOOL := TRUE;
bVar : BOOL;
END_VAR
bSetVariable S= bResetVariable R= F_Sample(bIn := bVar);
bResetVariable receives the R= assignment of the return value of F_Sample. bSetVariable receives the S= assignment of the return value of F_Sample but not of bResetVariable.