
7 APPLICATION INSTRUCTION
7.19 Clock instruction
585
7
Subtracting clock data
TSUB(P)
These instructions subtract the time data stored in the device numbers starting from (s2) from the clock data stored in the
device numbers starting from (s1), and store the result to the device numbers starting from (d).
Setting data
■
Descriptions, ranges, and data types
■
Applicable devices
Processing details
• These instructions subtract the time data stored in the device numbers starting from (s2) from the clock data stored in the
device numbers starting from (s1), and store the result to the device numbers starting from (d).
Ex.
When subtracting 3:50:10 from 10:40:20
• If the remainder is a negative time value, the borrow flag turns on. The actual result will be the remainder plus 24:00:00. For
example, if a time value of 10:42:12 is subtracted from another time value of 4:50:32, the remainder is -6:08:20. However,
the actual subtraction result will be 18:08:20.
• If the result is 0 (0:00:00), the zero flag turns on.
• The table below shows the related devices.
Ladder diagram
Structured text
Not supported
Operand
Description
Range
Data type
Data type (label)
(s1)
Head device number where the clock data that is subtracted is stored
16-bit signed binary
ANY16
(s2)
Head device number where the subtracting time value (or clock data
value) is stored
16-bit signed binary
ANY16
(d)
Head device number where the resultant clock data (or time value) is
stored
16-bit signed binary
ANY16
Operand
Bit
Word
Double word
Indirect
specification
Constant
Others
X, Y, M, L,
SM, F, B, SB
U
\G
T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U
\G
Z
LC
LZ
K, H
E
$
(s1)
(s2)
(d)
Device
Name
Description
SM8020
Zero
If the result is 0:00:00, this special relay turns on.
SM8021
Borrow
If the execution result of the TSUB(P) instruction is less than 0:00:00, this special relay turns on.
(s1)
(s2)
(d)
(s1)
(s1)+1
(s1)+2
-
(s2)
(s2)+1
(s2)+2
(d)
(d)+1
(d)+2
Data range
(0 to 23)
(0 to 59)
(0 to 59)
Hour
Minute
Second
Data range
(0 to 23)
(0 to 59)
(0 to 59)
Hour
Minute
Second
Data range
(0 to 23)
(0 to 59)
(0 to 59)
Hour
Minute
Second
(s1)
(s1)+1
(s1)+2
-
(s2)
(s2)+1
(s2)+2
(d)
(d)+1
(d)+2
10
40
20
3
50
10
6
50
10
(s1)
(s1)+1
(s1)+2
-
(s2)
(s2)+1
(s2)+2
(d)
(d)+1
(d)+2
4
50
32
10
42
12
18
8
20
Summary of Contents for MELSEC iQ-F FX5 series
Page 1: ...MELSEC iQ F FX5 Series Programming Manual Instructions Standard Functions Function Blocks ...
Page 2: ......
Page 21: ...19 PART 1 PART 1 OVERVIEW Part 1 consists of the following chapter 1 OVERVIEW ...
Page 98: ...96 4 STANDARD FUNCTIONS FUNCTION BLOCKS 4 2 Standard Function Blocks MEMO ...
Page 840: ...838 23 TIME DATA FUNCTIONS 23 4 Division MEMO ...
Page 887: ......