Learn PLCs free
Selection & LimitingIntermediateIEC 61131-3

MUX (Multiplexer)

Selects one of N input values based on an integer selector index.

The MUX (Multiplexer) function selects one of multiple input values based on an integer selector input (K). When K=0, IN0 is selected; when K=1, IN1 is selected; and so on. MUX extends the binary selection of SEL to support multiple choices. It is used for recipe parameter selection, multi-mode operation, selecting between multiple sensor inputs, and implementing lookup-table logic without using arrays.

Parameters

Inputs

NameTypeDescription
KINTSelector index (0 to N-1)
IN0ANYValue selected when K=0
IN1ANYValue selected when K=1
IN2ANYValue selected when K=2
INnANYAdditional inputs as needed

Outputs

NameTypeDescription
OUTANYSelected input value

Structured Text Example

// Select speed based on gear position
Motor_Speed := MUX(K := Gear_Position,
    IN0 := 0.0,      // Neutral
    IN1 := 500.0,     // Low speed
    IN2 := 1000.0,    // Medium speed
    IN3 := 1500.0     // High speed
);

// Equivalent CASE statement:
CASE Gear_Position OF
    0: Motor_Speed := 0.0;
    1: Motor_Speed := 500.0;
    2: Motor_Speed := 1000.0;
    3: Motor_Speed := 1500.0;
END_CASE;

20 Production-Ready Ladder Logic Templates

Stop writing the same rungs from scratch. Get copy-paste-ready templates for motor control, PID loops, safety interlocks, conveyors, and more.

Platform-Specific Implementation

S

Siemens (TIA Portal)

Use MUX instruction in TIA Portal. Available in FBD and SCL.

AB

Allen-Bradley (Studio 5000)

No direct MUX; implement with CASE/CMP and MOV instructions.

C

CODESYS

Use MUX() function in ST. Supports variable number of inputs.

Common Applications

  • Recipe parameter tables
  • Multi-speed selection
  • Multi-mode operation parameters
  • Sensor input selection
  • State-dependent output values

Frequently Asked Questions

What is MUX (Multiplexer) in PLC programming?

Selects one of N input values based on an integer selector index. The MUX (Multiplexer) function selects one of multiple input values based on an integer selector input (K). When K=0, IN0 is selected; when K=1, IN1 is selected; and so on.

What are common applications of MUX (Multiplexer)?

MUX (Multiplexer) is commonly used for: Recipe parameter tables, Multi-speed selection, Multi-mode operation parameters, Sensor input selection, State-dependent output values.

How do I use MUX (Multiplexer) in different PLC platforms?

Siemens: Use MUX instruction in TIA Portal. Available in FBD and SCL. Allen-Bradley: No direct MUX; implement with CASE/CMP and MOV instructions. CODESYS: Use MUX() function in ST. Supports variable number of inputs.

Stop Writing Ladder Logic From Scratch

Get 20 production-ready ladder logic templates for $29 -- download instantly and use them on your next project today.

20
Ready-Made Templates
LD + ST
Both Languages Included
$29
One-Time Purchase
Get Instant Access -- $29

Instant download - 30-day money-back guarantee - Use on unlimited projects

Free PLC simulator

Wire this block up and run it

Drop the instruction into a rung, hit Run, and watch it execute in your browser. 12 guided lessons across 8 PLC dialects — free account, no credit card.

Practice PLCs free →