6 - 47 6 - 47
6 IEC FUNCTIONS
6.8 Selection Functions
6.8.1 Binary selection SEL
SEL_E
One data is selected from among the specified two data according to the selection condition.
Function definition
ANY SEL( BOOL S1, ANY S2, ANY S3 );
Argument
Argument Name
IN/OUT
Description
S1 IN
Selection
condition
S2
IN
Data to be selected when S1 is FALSE
S3
IN
Data to be selected when S1 is TRUE
Return value
Return Value
Description
ANY Selection
result
When S1 is FALSE ....... Return value = S2
When S1 is TRUE ......... Return value = S3
Example of use
Argument Type
ST Program
Conversion Result
Used Instruction
REAL
r_data1 := SEL( b_select,
r_data2, r_data3 );
LDI b_select
EMOV r_data2
r_data1
LD b_select
EMOV r_data3
r_data1
LDI, EMOV, LD,
INT D1
:=
SEL( X1, D2, D3 );
LDI X1
MOV D2
D1
LD X1
MOV D3
D1
LDI, MOV, LD
DINT K8X100
:=
SEL( X1, K8X10,
K2147483647 );
LDI X1
DMOV K8X10
K8X100
LD X1
DMOV K2147483647
K8X100
LDI, DMOV, LD
BOOL
b_result := SEL( b_select,
b_data1, b_data2 );
LDI b_select
MPS
AND b_data1
SET b_result
MPP
ANI b_data1
RST b_result
LD b_select
MPS
AND b_data2
SET b_result
MPP
ANI b_data2
RST b_result
LDI, MPS,AND, SET, MPP,
ANI, RST,LD
STRING
s_result := SEL( b_select,
s_ary1, s_ary2 );
LDI b_select
$MOV s_ary1
s_result
LD b_select
$MOV s_ary2
s_result
LDI, $MOV,LD
Содержание MELSEC L series
Страница 1: ...Programming Manual Structured Text ...
Страница 2: ......
Страница 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Страница 297: ......