Block that creates 16 new BOOL variables from the decomposition of a WORD variable.
Ladder Representation

Block Structure
Variable Type |
Name |
Data Type |
Description |
VAR_INPUT |
EN |
BOOL |
Block enabling |
Word |
WORD UINT INT |
Input variable of 16 bits |
|
VAR_OUTPUT |
ENO |
BOOL |
End of operation |
Bit0 – Bit15 |
BOOL |
Bit of the corresponding position of Word |
Operation
When this block has a TRUE value in EN, it decomposes the input variable in Word 15 Boolean values stored in Bit0 to Bit15 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

Example in Ladder

The example above decomposes the value of MYWORD in Boolean values, which are stored in the output variables BIT0 to Bit15. 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 MYWORD : WORD := 45985; BIT0 : BOOL; BIT1 : BOOL; BIT2 : BOOL; BIT3 : BOOL; BIT4 : BOOL; BIT5 : BOOL; BIT6 : BOOL; BIT7 : BOOL; BIT8 : BOOL; BIT9 : BOOL; BIT10 : BOOL; BIT11 : BOOL; BIT12 : BOOL; BIT13 : BOOL; BIT14 : BOOL; BIT15 : BOOL; END_VAR
DO1 := FB_DEMUX( EN:=DI1, Word0:=MYWORD, Bit0=>BIT0, Bit1=>BIT1, Bit2=>BIT2, Bit3=>BIT3, Bit4=>BIT4, Bit5=>BIT5, Bit6=>BIT6, Bit7=>BIT7, Bit8=>BIT8, Bit9=>BIT9, Bit10=>BIT10, Bit11=>BIT11, Bit12=>BIT12, Bit13=>BIT13, Bit14=>BIT14, Bit15=>BIT15);
|
|---|