Справочник Пользователя для Mitsubishi Electronics FX2NC

Скачать
Страница из 382
FX Series Programmable Controlers
Applied Instructions 5
5-138
5.14.4
TSUB (FNC 163)
Contents:
Each of S
1
, S
and D specify the head address of 3
data devices to be used a time value.
The time value in S
is subtracted from the time
value in S
2
, the result is stored to D as a new time
value.
Points to note:
a) The subtraction is performed according to standard time values. Hours, minutes and
seconds are kept within correct limits. Any underflow is correctly processed.
b) If the subtraction of the two times results in a value less than 00:00:00 hours, the value of
the result is the time remaining below 00:00:00 hours.
When this happens the borrow flag M8021 is set ON.
c) If the subtraction of the two times results in a value of zero (00:00:00 hours) then the zero
flag M8020 is set ON.
d) The same device may be used as a source (S1 or S2) and destination device. In this case
the subtraction is continually executed; the destination value changing each program scan.
To prevent this from happening, use the pulse modifier or an interlock program.
Mnemonic
Function 
Operands
Program steps
S
1
S
2
D
TSUB
FNC 163
(Time
Subtrac-
tion)
Subtracts one
time value from
another to give a
new time
T, C, D
Note: 3 consecutive devices are used.
TSUB,
TSUBP:
7 steps
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
PULSE-P
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
16 BIT OPERATION
FX
FX
0N
FX
0(s)
FX
(2C)
FX
2N(C)
32 BIT OPERATION
FLAGS
Zero M8020
Borrow M8021
D10
D20
D30
TSUB
X13
[ S1 ] [ S2 ]
[ D ]
D10: 10 hours
D11: 30 mins
D12: 27 secs
10:30:27
S
1
-
D20: 3 hours
D21: 10 mins
D22: 49 secs
03:10:49
S
2
=
D30: 7 hours
D31: 19 mins
D32: 38 secs
07:19:38
D
D10: 10 hours
D11: 17 mins
D12: 29 secs
10:17:29
S
1
-
D20: 18 hours
D21: 12 mins
D22: 34 secs
18:12:34
S
2
=
D30: 13 hours
D31: 41 mins
D32: 16 secs
16:04:55
D
M8021 ON