MUX
PROGRAM MUX_DEMO VAR REAL1: REAL; INT1:INT; END_VAR REAL3:= MUX(K:=0, IN0:=1, IN2:=3, IN3:=4); END_PROGRAM
The function multiplexes the input signals to a single output. The input signal K specifies which of the IN inputs will be brought to the output. At K=0 the output has value of IN0. For K, that is out of range of defined inputs, output will always be value from the first valid input.
The inputs should be defined with no gaps in numbering; if an input will not be used, it can be made invisible by unchecking the “Visible” property. At the invisible inputs, please enter a value which has to be brought to the output in case this input is selected.
Input | Type | Description |
IN0.. | ANY | Input value |
K | ANY_INT | Input value selector |
Output | Type | Description |
⇒ | ANY | Output value |