Skip to main content

7.7.1 SEL

Function

According to the input value of G, the output IN0 or IN1 is selected

LD graphics

alt text

Parameter description

Interface variableDeclarationData typeDescription
GVar_InputBOOLEnter 0 or 1 to select the output object
IN0Var_InputANY_ELEMENTARYObject to be selected
IN1Var_InputANY_ELEMENTARYObject to be selected
Function nameReturn valueANY_ELEMENTARYIf G=0, then OUT:=IN0; if G=1, then OUT:=IN1
warning
  • The parameter types of parameters IN0, IN1 and OUT must be the same, otherwise the function cannot be executed
  • ANY_ELEMENTARY includes all basic types (bit strings, integers, floating point numbers, characters and strings, times and dates)

Example

  • LD sample animation is as follows:

alt text

  • ST example is shown in the following code:
OUT:=SEL(G:=bVar,IN0:=10,IN1:=100);