5.2 Standard Functions Of One Numeric Variable
134
FXCPU Structured Programming Manual
(Application Functions)
5.2
Standard Functions Of One Numeric Variable
5.2.1
ABS(_E)
Outline
This function obtains the absolute value, and outputs it.
1. Format
*1.
Output variable
2. Set data
In explanation of functions, I/O variables inside ( ) are described.
Explanation of function and operation
1) This function obtains the absolute value of word [signed]/double word [signed]/float (single precision) data
stored in a device specified in
, and outputs the operation result to a device specified in
using
the data type of data stored in devices specified in a device specified in
.
This function is expressed as follows when the input value is "A" and the output operation result is "B".
2) When the data type stored in a device specified in
is word [signed] and the stored data is "-32768",
this function outputs "-32768" to a device specified in
. (The maximum absolute value handled by this
function is "32,767".)
When the data type stored in a device specified in
is double word [signed] and the stored data is "-
2147483648", this function outputs "-2147483648" to a device specified in
. (The maximum absolute
value handled by this function is "2147483647".)
Cautions
Use the function having "_E" in its name to connect a bus.
FX
3U(C)
FX
3G
FX
2N(C)
FX
1N(C)
FX
1S
FX
U
/FX
2C
FX
0N
FX
0(S)
Function name
Expression in each language
Structured ladder
ST
ABS
ABS(_IN);
Example:
D10:=
ABS(D0);
ABS_E
ABS_E(EN,_IN,Output label);
Example:
ABS_E(X000,D0,D10);
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
_IN (
)
Data whose absolute value is to be obtained, or word device which
stores such data
ANY_NUM
Output
variable
ENO
Execution status
Bit
*1
(
)
Word device which will store the operation result
ANY_NUM
ABS
*1
D10
D0
_IN
ABS_E
EN
ENO
*1
D10
X000
D0
_IN
s
d
s
d
s
B= A
s
d
s
d