5.9 Functions Of Time Data Types
199
FXCPU Structured Programming Manual
(Application Functions)
1
Outline
2
Function List
3
Function
Construction
4
How to Read
Explanation of
Functions
5
Applied
Functions
6
Standard
Function Blocks
A
Correspondence
between Devices
and Addresses
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) 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.
3) Even if underflow or overflow occurs in the operation result, it is not regarded as an operation error.
However, note that the accurate operation result cannot be obtained in this case.
("ADD_TIME_E" outputs "TRUE" from ENO.)
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 time data stored in devices specified in and
, and the operation result expressed as time data is output to devices specified in .
1) Function without EN/ENO(ADD_TIME)
2) Function with EN/ENO(ADD_TIME_E)
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]
[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
s1
s2
d
ADD_TIME
g_time1 _IN1
g_time3
g_time2 _IN2
g_time3:=ADD_TIME(g_time1,g_time2);
ADD_TIME_E
EN ENO
g_time3
g_bool3
g_bool1
g_time1 _IN1
g_time2 _IN2
g_bool3:=ADD_TIME_E(g_bool1,g_time1,g_time2,g_time3);