SELΒΆ

The IEC Operators and additional, norm-extending \ functions Binary selection.

OUT := SEL(G, IN0, IN1) means:

OUT := IN0 if G=FALSE;

OUT := IN1 if G=TRUE

IN0, IN1 and OUT can be any type of variable, G must be BOOL. The result of the selection is IN0 if G is FALSE, IN1 if G is TRUE.

Example in IL:

LD  TRUE
SEL 3,4   (* IN0 = 3, IN1 =4 *)
ST  Var1  (* Result is 4 *)
LD  FALSE
SEL 3,4
ST  Var1  (* Result is 3 *)

Example in ST:

Var1:=SEL(TRUE,3,4); (\* Result is 4 \*)

Example in FBD:

../_images/4da3d9356925c39c0a317d317a921b57

Note

An expression occurring ahead of IN1 or IN2 will not be processed if IN0 is TRUE.