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

DEMUX2

Demultiplexer

Previous pageReturn to chapter overviewNext page

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

 

Ladder Representation

 

DEMUX2_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

DWord

DWORD UDINT DINT

Input variable of 15 bits

VAR_OUTPUT

ENO

BOOL

End of operation


Bit0 – Bit31

BOOL

Bit of the corresponding position of Word

 

Operation

 

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

 

When EN has FALSE value, output variables remain unchanged.

 

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

 

Block Flowchart

 

DEMUX2_flowchart

 

Example in Ladder

 

DEMUX2_example01

 

The example above decomposes the value of MYDWORD in Boolean values, which are stored in the output variables BIT0 to Bit31. The block ends successfully and the ENO output is activated

 

Example in ST

 

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

 

 

VAR

  ENTRADA : DWORD := 1456756758;

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

END_VAR

 

DO1 := FB_DEMUX2(

  EN:=DI1,

  DWord0:=ENTRADA,

  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]);