MUX

Multiplexer

OUT := MUX(K, IN0,...,INn) 

means:

OUT := INK.

IN0, ...,INn and OUT can be any type of variable. K must be BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT or UDINT. MUX selects the Kth value from among a group of values.

Example in IL:

LD 0

MUX 30,40,50,60,70,80

ST Var1 (* Result is 30 *)
MUX 1:

Note that an expression occurring ahead of an input other than INK will not be processed to save run time!