Multiplexer (MUX)
This information applies to the
CompactLogix
5370, ControlLogix
5570, Compact GuardLogix
5370, GuardLogix
5570, Compact GuardLogix
5380, CompactLogix
5380, CompactLogix
5480, ControlLogix
5580, and GuardLogix
5580 controllers.The Multiplexer (MUX) instruction selects one of eight inputs based on the selector input.
Available Languages
Ladder Diagram
This instruction is not available in ladder diagram.
Function Block
Structured Text
This instruction is not available in ladder diagram.
Operands
Function Block
Operand | Type | Format | Description |
Block tag | MULTIPLEXER | Structure | MUX structure |
MUX Structure
Input Parameter | Data Type | Description |
EnableIn | BOOL | Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set. |
In1 | REAL | The first analog signal input to the instruction.
Valid = any float
Default = 0.0 |
In2 | REAL | The second analog signal input to the instruction.
Valid = any float
Default = 0.0 |
In3 | REAL | The third analog signal input to the instruction.
Valid = any float
Default = 0.0 |
In4 | REAL | The fourth analog signal input to the instruction.
Valid = any float
Default = 0.0 |
In5 | REAL | The fifth analog signal input to the instruction.
Valid = any float
Default = 0.0 |
In6 | REAL | The sixth analog signal input to the instruction.
Valid = any float
Default = 0.0 |
In7 | REAL | The seventh analog signal input to the instruction.
Valid = any float
Default = 0.0 |
In8 | REAL | The eighth analog signal input to the instruction.
Valid = any float
Default = 0.0 |
Selector | DINT | The selector input to the instruction. This input determines which of the inputs (1-8) is moved into Out. If this value is invalid (which includes 0), the instruction sets the appropriate bit in Status and holds Out at its current value.
Valid = 1 to 8
Default = 0 |
Output Parameter | Data Type | Description |
EnableOut | BOOL | Indicates if the instruction is enabled. Cleared on overflow. |
Out | REAL | The selected output of the algorithm. Math status flags are set for this output. |
Status | DINT | Status of the function block. |
InstructFault (Status.0) | BOOL | The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred. |
SelectorInv (Status.1) | BOOL | Invalid Selector value. |
Description
Based on the Selector value, the MUX instruction sets Out equal to one of eight inputs.
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See Common Attributes for operand-related faults.
Execution
Function Block
Condition | Action |
Prescan | EnableIn and EnableOut bits are cleared to false. |
Tag.EnableIn is false | EnableIn and EnableOut bits are cleared to false. |
Tag.EnableIn is true | EnableIn and EnableOut bits are set to true. The instruction executes. |
Instruction first run | N/A |
Instruction first scan | Set internal value of Out to zero. |
Postscan | EnableIn and EnableOut bits are cleared to false. |
Example
Function Block
This MUX instruction selects In1, In2, or In3, In4, In5, In6, In7, or In8 based on the Selector. The instruction sets Out = In
n
, which becomes an input parameter for function_block_C. For example, if select_value = 2, the instruction sets Out = analog_input2.Provide Feedback