ExST assignment S=

If the operand of the Set assignment switches to TRUE, the assignment causes the variable to the left of the operator to be assigned a TRUE. The variable is set.

Syntax:

<variable name> S= <operand name> ;

The variable and the operand have the data type BOOL.

Sample:

PROGRAM MAIN
VAR
    bOperand     : BOOL := FALSE;
    bSetVariable : BOOL := FALSE;
END_VAR
bSetVariable S= bOperand;

If the operand bOperand switches from FALSE to TRUE, the variable bSetVariable is assigned a TRUE. But then the variable keeps this state even if the operand continues to change its state.

Multiple assignments

ExST assignment S= 1:

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.