Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
MUX¶
Multiplexer — selects one of several inputs by index.
IEC 61131-3 |
Section 2.5.1.5.5 |
Support |
Supported |
Signatures¶
# |
Input (K) |
Input (IN0) |
Input (IN1, …) |
Return Type |
Support |
|---|---|---|---|---|---|
1 |
|
ANY |
ANY |
ANY |
Supported |
Description¶
MUX(K, IN0, IN1, ...) returns the input selected by the zero-based
index K. The number of inputs is variable, and all inputs must be
the same type.
If K = 0, returns IN0
If K = 1, returns IN1
And so on
If K is out of range, the value is clamped: negative K selects IN0, and K greater than or equal to the number of inputs selects the last input. Supports 2 to 16 input values.
This function is polymorphic: it works with any data type for the selected inputs.