MUX_UINT block

Short summary

Name

MUX_UINT

→POU type

→function

Category

Standard (safe), Select, block with internal error diagnostic

Conform to →IEC-standard

(plus) more possible than defined in IEC-standard
(IEC demands ANY_ELEMENTARY for the inputs and the return value.)

but also:

(error) currently restricted
(IEC demands data type ANY_ELEMENTARY for the inputs, hence the following data types are demanded as well: LTIMEWSTRINGWCHARLDATE_AND_TIMELTIME_OF_DAY and LDATE. Currently, these data types are not supported for the block.) 

Graphical interface

Available since

version 1.22.0 (for Neuron Power Engineer) – initial variant

version 1.109.0 (for Neuron Power Engineer) – enhancement: STRING and CHAR for IN0, IN1 ... IN15 and for the return value

version 3.0.1 (for library Standard) – enhancement: user-defined data types and references for IN0IN1 ... IN15 and for the return value 

version 3.8.0 (for library Standard (non-safe)): block moved in this library

Functionality

Depending on the input K, the block selects one of the values connected at the other inputs.

If value 0 is connected at input K, the block returns the value connected at input IN0. Value 1 for input K has the block return the value connected at input IN1, value 2 has the value of input IN2 returned etc.

Inputs, return value

 

Identifier

→Data type

Description

Inputs:

K

UINT

selector

IN0

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

1st value

IN1

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

2nd value

... (extensible until)

 

IN15

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

16th value

Return value:

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

 

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Internal error diagnostic for block 

The block checks the value connected to input K before it is executed.
If the value for K is > the highest connected input, the output ENO of the block is set to value FALSE (or an equivalent) and the block returns the value 0.

Example for usage within ST-editor

PROGRAM Test
    VAR
        result1, result2, result3, result4 : UINT;
        stateENO1 : BOOL;
    END_VAR
    result1 := MUX_UINT(K := 2, IN0 := 1, IN1 := 2, IN2 := 3, IN3 := 4, IN4 := 5);       (* The variable 'result1' evaluates to '3'. *)
    result2 := MUX_UINT(K := 4, IN0 := 1, IN1 := 2, IN2 := 3, IN3 := 4, IN4 := 5);       (* The variable 'result2' evaluates to '5'.  *)
    result3 := MUX_UINT(K := 0, IN0 := 1, IN1 := 2, IN2 := 3, IN3 := 4, IN4 := 5);       (* The variable 'result3' evaluates to '1'.  *)
    result4 := MUX_UINT(K := 7, IN0 := 1, IN1 := 2, IN2 := 3, IN3 := 4, IN4 := 5, ENO => stateENO1);      (* The variable 'result4' evaluates to '0', 'stateENO1' to 'FALSE'. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.