Description
You can use the instruction "Multiplex" to copy the content of a selected input to output OUT. In its initial state the instruction box contains at least 2 inputs (IN0 and IN1). The number of selectable inputs of the instruction box can be expanded. You can declare a maximum of 32 inputs.
The inputs are numbered automatically in the box. Numbering starts at IN0 and is incremented continuously with each new input. You use the K parameter to define the input whose content is to be copied to the OUT output. If the value of the parameter K is greater than the number of available inputs, the content of the parameter ELSE is copied to output OUT and enable output ENO is assigned the signal state "0".
The "Multiplex" instruction can only be executed if the tags have the same data type in all inputs and in the OUT output. The K parameter is an exception, since only integers can be specified for it.
The enable output ENO is reset if one of the following conditions applies:
-
Enable input EN has the signal state "0".
-
The input at the K parameter is located outside the available inputs. This is the reaction regardless of whether the ELSE input will be used or not. The value at the OUT output remains unchanged.
-
Errors occurred during execution of the instruction.
Parameters
The following table shows the parameters of the "Multiplex" instruction:
|
Parameters |
Declaring |
Data type |
Memory area |
Description |
||
|---|---|---|---|---|---|---|
|
S7-1200 |
S7-1500 |
S7-1200 |
S7-1500 |
|||
|
EN |
Input |
BOOL |
BOOL |
I, Q, M, D, L or constant |
I, Q, M, D, L, T, C or constant |
Enable input |
|
ENO |
Output |
BOOL |
BOOL |
I, Q, M, D, L |
I, Q, M, D, L |
Enable output |
|
K |
Input |
Integers |
Integers |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
Specifies the input whose content is to be copied.
|
|
IN0 |
Input |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, DATE |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, LTOD, DATE, LDT |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
First input value |
|
IN1 |
Input |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, DATE |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, LTOD, DATE, LDT |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
Second input value |
|
INn |
Input |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, DATE |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, LTOD, DATE, LDT |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
Optional input values |
|
ELSE |
Input |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, DATE |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, LTOD, DATE, LDT |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
Specifies the value to be copied when K > n |
|
OUT |
Output |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, DATE |
Binary numbers, integers, floating-point numbers, timers, CHAR, WCHAR, TOD, LTOD, DATE, LDT |
I, Q, M, D, L, P |
I, Q, M, D, L, P |
Output to which the value is to be copied |
You can select the data type of the instruction from the "???" drop-down list of the instruction box.
For additional information on valid data types, refer to "See also".
Example
The following example shows how the instruction works:
The following table shows how the instruction works using concrete operand values:
|
Parameters |
Operand |
Value |
|---|---|---|
|
K |
Tag_Number |
1 |
|
IN0 |
Tag_ValueI_0 |
DW#16#00000000 |
|
IN1 |
Tag_Value_1 |
DW#16#003E4A7D |
|
ELSE |
Tag_Value_2 |
DW#16#FFFF0000 |
|
OUT |
Tag_Result |
DW#16#003E4A7D |
If the "Tag_Input" operand has signal state "1", the instruction is executed. Depending on the value of the operand "Tag_Number", the value at input "Tag_Value_1" is copied and assigned to the operand at output "Tag_Result". If no errors occur during the execution of the instruction, the outputs ENO and "Tag_Output" are set.