Chapter 16 PLC Function ApplicationsC2000-HS
16-106
API
TSUB
Calendar data subtraction
163
P
Bit device Word device
16-bit command (7 STEP)
TSUB Continuous
execution type
TSUBP Pulse
execution type
32-bit command
- - - -
Flag signal: M1020 Zero flag
M1022 Carry flag
M1068 Calendar error
X Y M K H KnX KnY KnM T C D
S1 * * *
S2 * * *
D * * *
Notes on operand usage:
Please refer to the function specifications table for each device in
series for the scope of device usage
S
1
: time minuend. S
2
: time augend. D: time sum.
Subtracts the calendar data in hours, minutes, and seconds designated by S
2
from
the calendar data in hours, minutes, and seconds designated by S
1
, and the result
is temporarily stored as hours, minutes, and seconds in the register designated by
D.
If the value of S
1
or S
2
exceeds the range, this is considered an operating error, the
command will not execute, M1067, M1068=On, and D1067 will record the error
code 0E1A(HEX).
If subtraction results in a negative number, borrow flag M1021=On, and the result of
that negative number plus 24 hours will be displayed in the register designated by
D.
If the results of subtraction are equal to 0 (0 hours, 0 minutes, 0 seconds), zero flag
M1020=On.
When X10=On, the TADD command will be executed, and the calendar data in
hours, minutes, and seconds designated by D10 to D12 will be subtracted from the
calendar data in hours, minutes, and seconds designated by D0 to D2, and the
results are stored as a total number of hours, minutes, and seconds in the registers
designated by D20 to D22.
X10
TSUB D0 D10 D20