Navigation:  Equipments (Devices) > SCA06 > Ladder > Data Transfer >

MUX2

Multiplexer

Previous pageReturn to chapter overviewNext page

Block that creates a new DWORD variable from the concatenation of 32 BOOL variables.

 

 

Ladder Representation

 

MUX2_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

Bit0 – Bit31

BOOL

Bit of the corresponding position in the new word

VAR_OUTPUT

ENO

BOOL

End of operation

DWord

DWORD UDINT DINT

New word formed from the input bits

 

Operation

 

When this block has a TRUE value in EN, it concatenates Boolean values of the input variables and stores this value in the variable DWord. Bit0 corresponds to LSB (least significant bit) and Bit31 corresponds to the MSB (most significant bit).

 

When EN has FALSE value, Word remains unchanged.

 

The ENO value forwards to the next Ladder block the EN value after the operation is completed.

 

Block Flowchart

 

MUX2_flowchart

 

Example in Ladder

 

MUX2_example01

 

The above example concatenates the Boolean values of the input bits of the block to form the output word stored in MYDWORD. The block ends with success and ENO output is activated.

 

Example in ST

 

 The example below displays the instructions for applying the example above in the ST language.

 

 

VAR

   ARRAY_BOOL : ARRAY[0..31] OF BOOL := [

      0, 1, 1, 0, 1, 0, 0, 0,

       0, 0, 0, 1, 1, 0, 1, 0,

       0, 0, 1, 0, 1, 0, 1, 1,

       0, 1, 1, 0, 1, 0, 1, 0];

  MYDWORD : DWORD;

END_VAR

 

MYDWORD := FB_MUX2(

   EN:=DI1,

   Bit0:=ARRAY_BOOL[0],

   Bit1:=ARRAY_BOOL[1],

   Bit2:=ARRAY_BOOL[2],

   Bit3:=ARRAY_BOOL[3],

   Bit4:=ARRAY_BOOL[4],

   Bit5:=ARRAY_BOOL[5],

   Bit6:=ARRAY_BOOL[6],

   Bit7:=ARRAY_BOOL[7],

   Bit8:=ARRAY_BOOL[8],

   Bit9:=ARRAY_BOOL[9],

   Bit10:=ARRAY_BOOL[10],

   Bit11:=ARRAY_BOOL[11],

   Bit12:=ARRAY_BOOL[12],

   Bit13:=ARRAY_BOOL[13],

   Bit14:=ARRAY_BOOL[14],

   Bit15:=ARRAY_BOOL[15],

   Bit16:=ARRAY_BOOL[16],

   Bit17:=ARRAY_BOOL[17],

   Bit18:=ARRAY_BOOL[18],

   Bit19:=ARRAY_BOOL[19],

   Bit20:=ARRAY_BOOL[20],

   Bit21:=ARRAY_BOOL[21],

   Bit22:=ARRAY_BOOL[22],

   Bit23:=ARRAY_BOOL[23],

   Bit24:=ARRAY_BOOL[24],

   Bit25:=ARRAY_BOOL[25],

   Bit26:=ARRAY_BOOL[26],

   Bit27:=ARRAY_BOOL[27],

   Bit28:=ARRAY_BOOL[28],

   Bit29:=ARRAY_BOOL[29],

   Bit30:=ARRAY_BOOL[30],

   Bit31:=ARRAY_BOOL[31],

   ENO=>DO1);