7.7.1 SEL
Function
According to the input value of G, the output IN0 or IN1 is selected
LD graphics
Parameter description
| Interface variable | Declaration | Data type | Description |
|---|---|---|---|
| G | Var_Input | BOOL | Enter 0 or 1 to select the output object |
| IN0 | Var_Input | ANY_ELEMENTARY | Object to be selected |
| IN1 | Var_Input | ANY_ELEMENTARY | Object to be selected |
| Function name | Return value | ANY_ELEMENTARY | If 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:

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