MUX (Multiplexor)

Function Name

MUX

Description

The MUX or multiplexor function outputs the same number as one of its inputs. The input that is chosen is dependent on the value of the K input.

The MUX function has a K (integer) input and 2 or more other inputs. The unnamed inputs are recognized as being 0 for the first (top) input, 1 for the second input, 2 for the third input, 3 for the fourth input and so on. The number of the K input is used to identify which of the other inputs has the value that is to be used as the output.

Arguments

K {ANY_INT}.

The number for the K input is used to identify the input that is to be used as the output for the MUX function.

Input 0 - Input n {ANY}

Each input is identified by a number, with the first (top) input being 0, the second being 1, the third being 2 and so on.

For more information on the data types for the inputs and outputs, see Data Type Hierarchy.

Returns

Output {ANY}

The K input is a number. This number is used to identify the input that has the value that is to be used as the output. The output value is of the same type as the value provided by the designated input.

Example:

Function Block Diagram - MUX:

In this example, the K value is provided by a tag that represents the CurrentState property of a 1 bit digital point named 'Flowpresent', (see Add Variables to a Function Block Diagram). The state of the digital point is either 0 or 1. The diagram below illustrates the MUX output for both states of the digital point

The number of inputs in a MUX function are only limited by the source of the K value. Illustrated below is a 3 bit digital point used to provide the K value and 8 possible input values. The digital point can have a value between 0 and 7, which determines the MUX output value.

ST Program - MUX:

The syntax for a MUX function in an ST Program is:

Output := MUX (K, Input 0, Input 1, ....Input n);

Where Output, K, Input 0, Input 1 and all inputs up to Input n are defined as variables earlier in the ST program.


Disclaimer

ClearSCADA 2017 R2