Skip to main content

SEL

SEL selects one of two input values and writes it to Result according to the state of Selector.

Ladder Representation

SEL block representation

Variable Table

Variable TypeNameData TypeDescription
VAR_INPUTENBOOLEnables block execution.
VAR_INPUTSelectorBOOLSelects which input is copied to the output.
VAR_INPUTValue0BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL STRINGFirst input value.
VAR_INPUTValue1BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL STRINGSecond input value.
VAR_OUTPUTENOBOOLIndicates the end of the operation.
VAR_OUTPUTResultBYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL STRINGSelected output value.

Operation

When EN is TRUE, SEL writes Value0 to Result when Selector is FALSE. When Selector is TRUE, SEL writes Value1 to Result.

When EN is FALSE, Result remains unchanged.

ENO passes the EN value to the next Ladder block after the operation finishes.

Execution Flowchart

SEL execution flowchart

Examples

SEL Ladder example selecting Value0 when Selector is false

In this example, SELECTOR is FALSE, so RESULT receives VALUE0. The block finishes successfully and activates ENO.

SEL Ladder example preserving a binary pattern with DWORD representation

This example also uses SELECTOR as the selection input. With SELECTOR at FALSE, RESULT receives VALUE0. The binary pattern is preserved even though the decimal representation is not valid for negative values in DWORD.

SEL Ladder example selecting Value1 when Selector is true

In this example, SELECTOR is TRUE, so RESULT receives VALUE1. The binary pattern is preserved even though the decimal representation is not valid for negative values in DWORD.