SEL block

Short summary

Name

SEL

→POU type

→function

Category

IEC-block, Select

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/error.svg currently restricted
(IEC demands data type ANY for the inputs and the return value. Hence the following data types are demanded as well: LTIME, WSTRING, WCHAR, LDATE_AND_TIME, LTIME_OF_DAY and LDATE . Currently, these data types are not supported for the block.)

Graphical interface

images/download/thumbnails/414782371/SEL-version-1-modificationdate-1535100124745-api-v2.png

Available since

  • version 1.21.0 (for logi.CAD 3) – initial variant

  • version 1.109.0 (for logi.CAD 3) – enhancement: STRING , CHAR, user-defined data types and references for IN1, IN2 and for the return value

Functionality

The block makes a binary selection.

If input G is set to value FALSE (or an equivalent), the block returns the value of input IN0. If input G is set to value TRUE (or an equivalent), the block returns the value of input IN1.

Inputs, return value


Identifier

→Data type

Description

Inputs:

G

BOOL

selector

IN1

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT, LINT, TIME, BOOL, BYTE, WORD, DWORD, LWORD, STRING, CHAR, DATE_AND_TIME, DATE, TIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

1st value

IN2

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT, LINT, TIME, BOOL, BYTE, WORD, DWORD, LWORD, STRING, CHAR, DATE_AND_TIME, DATE, TIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

2nd value

Return value:

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT, LINT, TIME, BOOL, BYTE, WORD, DWORD, LWORD, STRING, CHAR, DATE_AND_TIME, DATE, TIME_OF_DAY, a →user-defined data type, a →function block or a →reference
Restriction: In case of →array data types, only one-dimensional arrays are allowed.


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

PROGRAM Test
VAR
result1 : INT;
result2 : DINT;
END_VAR
result1 := SEL(G := FALSE, IN0 := INT#1, IN1 := USINT#2); (* The variable 'result' evaluates to '1'. *)
result2 := SEL(G := TRUE, IN0 := DINT#1, IN1 := USINT#2); (* The variable 'result' evaluates to '2'. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.