DEMUX: Demultiplex (S7-1200, S7-1500) - STEP 7

FBD (S7-1200, S7-1500)

ft:publication_title
FBD (S7-1200, S7-1500)
Product
STEP 7
Version
V20
Publication date
11/2024
Language
en-US
DEMUX: Demultiplex

Description

You can use the instruction "Demultiplex" to copy the content of the input IN to a selected output. In its initial state the instruction box contains at least 2 outputs (OUT0 and OUT1). The number of selectable outputs can be extended in the instruction box. The outputs are numbered automatically in the box. Numbering starts at OUT0 and continues consecutively with each new output. You use the K parameter to define the output to which the content of the IN input is to be copied. The other outputs are not changed. If the value of the parameter K is greater than the number of available outputs, then the content of input IN is copied to the parameter ELSE and the enable output ENO is assigned the signal state "0".

The instruction "Demultiplex" can only be executed if the tags at the input IN and at all outputs are of the same data type. 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 value of the K parameter is greater than the number of available outputs.

  • Errors occurred during execution of the instruction.

Parameters

The following table shows the parameters of the instruction "Demultiplex":

Parameter

Declaration

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 output to which the input value (IN) is copied.

  • If K = 0 => Parameter OUT0

  • If K = 1 => Parameter OUT1, etc.

IN

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

Input value

OUT0

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

First output

OUT1

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

Second output

OUTn

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

Optional outputs

ELSE

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 input value (IN) at K > n is copied.

You can select the data type of the instruction from the "<???>" drop-down list of the instruction box.

For additional information on available data types, refer to "See also".

Example

The following example shows how the instruction works:

The following tables show how the instruction works using specific operand values:

Input values of the "Demultiplex" instruction before network execution

Parameter

Operand

Values

K

Tag_Number

1

4

IN

Tag_Value

DW#16#FFFFFFFF

DW#16#003E4A7D

Output values of the "Demultiplex" instruction after network execution

Parameter

Operand

Values

OUT0

Tag_Output_0

Unchanged

Unchanged

OUT1

Tag_Output_1

DW#16#FFFFFFFF

Unchanged

ELSE

Tag_Output_2

Unchanged

DW#16#003E4A7D

If the "Tag_Input" input has the signal state"1", the "Demultiplex" instruction is executed. Depending on the value of the operand "Tag_Number", the value at input "IN" is copied to the corresponding output.