5.3 Standard Arithmetic Functions
137
FXCPU Structured Programming Manual
(Application Functions)
1
O
utlin
e
2
Function Li
st
3
Functi
on
Cons
tructi
on
4
Ho
w t
o R
ea
d
Explanati
on of
Func
tions
5
Appl
ie
d
Functions
6
Stan
dard
Functi
on
Blocks
A
Correspondence
be
tw
een Dev
ice
s
an
d A
ddres
ses
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
2) Even if underflow or overflow occurs in the operation result, it is not regarded as an operation error.
"TRUE" is output from ENO.
However, note that the obtained operation result is not accurate in this case.
Either of the flags shown in the table below turns ON or OFF in accordance with the operation result.
Program example
In this program, addition is performed using double word [signed] data stored in devices specified in
and
, and the operation result is output to a device specified in
.
Device
Name
Description
M8020
Zero
ON : When the operation result is "0"
OFF: When the operation result is any other than "0"
M8021
Borrow
ON : When the operation result is less than "-32,768" (16-bit operation) or less than "-
2,147,483,648" (32-bit operation)
OFF: When the operation result is "-32,768" (16-bit operation) or more or "-2,147,483,648" (32-
bit operation) or more
M8022
Carry
ON : When the operation result exceeds "32,767" (16-bit operation) or "2,147,483,647" (32-bit
operation)
OFF: When the operation result is "32,767" (16-bit operation) or less or "2,147,483,647" (32-bit
operation) or less
[Structured ladder]
[ST]
Zero flag
-2 , -1 , 0 , -32,768
Borrow flag
Zero flag
-2 , -1 , 0 , -2,147,483,648
Borrow flag
The most
significant bit
of data is "1".
Zero flag
32,767 , 0 , 1 , 2
Carry flag
Zero flag
2,147,483,647 , 0 , 1 , 2
Carry flag
Zero flag
-1 , 0 , 1
Zero flag
-1 , 0 , 1
The most
significant bit
of data is "0".
s1
s2
d
ADD_E
EN
ENO
g_dint3
g_bool1
g_dint1
g_dint2
_IN
_IN
g_bool3
g_bool3:=ADD_E(g_bool1,g_dint1,g_dint2,g_dint3);
Содержание 09R927
Страница 2: ......
Страница 234: ...232 FXCPU Structured Programming Manual Application Functions Revision History MEMO ...