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

MUX

Previous pageReturn to chapter overviewNext page

Block that creates a new WORD variable from the concatenation of 16 BOOL variables.

 

Ladder Representation

 

MUX_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

Bit0 – Bit15

BOOL

Bit of the corresponding position in the new word

VAR_OUTPUT

ENO

BOOL

End of operation

Word

WORD UINT INT

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 Word. Bit0 corresponds to LSB (least significant bit) and Bit15 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

 

MUX_flowchart

 

Example in Ladder

 

MUX_example01

 

The above example concatenates the Boolean values of the input bits of the block to form the output word stored in MYWORD. 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

   MYWORD : WORD;

END_VAR

 

MYWORD := FB_MUX(

   EN:=DI1,

   Bit0:=DI2,

   Bit1:=DI3,

   Bit2:=DI2,

   Bit3:=DI2,

   Bit4:=DI2,

   Bit5:=DI2,

   Bit6:=DI3,

   Bit7:=DI3,

   Bit8:=DI3,

   Bit9:=DI2,

   Bit10:=DI3,

   Bit11:=DI2,

   Bit12:=DI3,

   Bit13:=DI3,

   Bit14:=DI3,

   Bit15:=DI2,

   ENO=>DO1);