Demux 4
easy
An input is routed to one of four outputs chosen by a select input (0 to 3).
What it teaches
Inverse of Mux 4 — the select value decides which one of four outputs follows the input while the rest stay 0. Reinforces that mux and demux are duals: the same per-value cases with the roles of input and output swapped.
Inputs and outputs
| Tag | Type | Default | Description |
|---|---|---|---|
| In_Value | DINT | 42 | Value to route |
| In_Select | DINT | 0 | Selector switch; 0 = select Out_0, 1 = select Out_1, 2 = select Out_2, 3 = select Out_3 |
| Out_0 | DINT | — | First output value |
| Out_1 | DINT | — | Second output value |
| Out_2 | DINT | — | Third output value |
| Out_3 | DINT | — | Fourth output value |
Required behavior
- When In_Select is 0, Out_0 equals In_Value while all other outputs are 0.
- When In_Select is 1, Out_1 equals In_Value while all other outputs are 0.
- When In_Select is 2, Out_2 equals In_Value while all other outputs are 0.
- When In_Select is 3, Out_3 equals In_Value while all other outputs are 0.
- When In_Select is outside the 0 to 3 range, all outputs are 0.