6 - 21 6 - 21
6 IEC FUNCTIONS
6.2 Numerical Functions (General Functions)
6.2.1 Absolute value ABS
ABS_E
The absolute value of the specified data is operated.
Function definition
ANY_NUM ABS ( ANY_NUM S1 );
Argument
Argument Name
IN/OUT
Description
S1
IN
Data whose absolute value will be found
Return value
Return Value
Description
ANY_NUM
Absolute value operation result
Example of use
Argument Type
ST Program
Conversion Result
Used Instruction
REAL
r_data1 := ABS( r_data2 );
LD
SM400
EMOV r_data2
r_data1
LDE<
r_data2 E0
E*
E-1
r_data2
r_data1
LD,EMOV, LDE<, E*
INT
D0 := ABS( D1 );
LD
SM400
MOV D1 D0
LD< D1 K0
NEG D0
LD,MOV, LD<, NEG
DINT di_data1
:= ABS( di_data2 ); LD
SM400
DMOV di_data2
di_data1
LDD< di_data2
K0
DCML di_data2
di_data1
D+ K1
di_data1
LD,DMOV, LDD<, DCML
D+
Function definition
BOOL ABS_E( BOOL EN, ANY_NUM S1, ANY_NUM D1 );
Argument
Argument Name
IN/OUT
Description
EN
IN
Execution condition (Function is executed only when the result is TRUE)
S1
IN
Data whose absolute value will be found
D1
OUT
Absolute value operation result
Return value
Return Value
Description
BOOL Execution
condition
Example of use
(*
(*
When execution condition X0 turns ON, the absolute value of the data stored
in iData is found, and the result is stored into Result.
M0 := ABS_E( X0, iData, Result ) ;
*)
*)
For the usable data type, refer to "3.2.2 About ANY type".
Содержание MELSEC L series
Страница 1: ...Programming Manual Structured Text ...
Страница 2: ......
Страница 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Страница 297: ......