Selection instructions
256
Part II IEC Instructions
MUX
Select value from multiple channels
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
PLC types
Availability of MUX (see page 1328)
When using the data type STRING with small PLCs like FP-e or FP0,
make sure that the length of the result string is equal to or greater than
the length of the source string.
For further information refer to the online help: Upgrade Problems with
Data Type STRING
The difference between the functions MUX and SEL (see page 257) is
that in MUX with an integer value you can select between plural
channels, and in SEL with a Boolean value only between two channels.
The number of input contacts lies in the range of 2 to 28.
Data type I/O Function
INT 1st input selects channel for 2nd or 3rd input value to be written to
all data types 2nd input value 1
all data types 3rd input value 2
all data types output as 2nd and
3rd input
result
The 2nd and 3rd input variables must be of the same data type.
In this example the input variables (channel_select, channel_0 and channel_1) have been
declared. Instead, you may enter a constant directly at the input contact of a function.
Description
The function Multiplexer selects an input variable and writes its value into the output variable. The
1st input variable determines which input variable (IN1or IN2 ...) is to be written into the output
variable. The function MUX can be configured for any desired number of inputs.
Data types
Example
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables used for programming this function have been declared in the POU
header.