Block that replicates to the output the value of an input variable (Value0 or Value1) according to the Selector selection.
Ladder Representation

Block Structure
Variable Type |
Name |
Data Type |
Description |
VAR_INPUT |
EN |
BOOL |
Block enabling |
Selector |
BOOL |
Variable that selects the input |
|
Value0 |
BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL LREAL |
Multiplexed input number 1 |
|
Value1 |
BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL LREAL |
Multiplexed input number 2 |
|
VAR_OUTPUT |
ENO |
BOOL |
End of operation |
Result |
BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL LREAL |
Output value selected |
Operation
When this block has a TRUE value in EN, it replicates to the Result variable the Value0 value if selector is FALSE or the Value1 value if Selector is TRUE.
When EN has FALSE value, Result remains unchanged.
The ENO value forwards to the next Ladder block the EN value after the operation is completed.
Block Flowchart

Example in Ladderr

The above example uses the SELECTOR variable as multiplexing channel selector. When it is at FALSE level, the RESULT output gets the value of VALUE0. The block ends successfully and the ENO output is activated.

The above example uses the SELECTOR variable as multiplexing channel selector. When it is at FALSE level, the RESULT output gets the value of VALUE0. The block ends successfully and the ENO output is activated. Note that the binary pattern has been maintained even though the decimal representation is corrupted, since DWORD does not accept negative values.

The above example uses the SELECTOR variable as multiplexing channel selector. When it is at TRUE level, the RESULT output gets the value of VALUE1. The block ends successfully and the ENO output is activated. Note that the binary pattern has been maintained even though the decimal representation is corrupted, since DWORD does not accept negative values.
Example in ST
The example below displays the instructions for applying the example above in the ST language.
VAR SELECTOR : BOOL := FALSE; VALUE0 : SINT := -52; VALUE1 : INT := -985; RESULT : INT; END_VAR
RESULT := FB_SEL( EN:=DI1, Selector:=SELECTOR, Value0:=VALUE0, Value1:=VALUE1, ENO=>DO1);
|
|---|