![background image](http://html1.mh-extra.com/html/eaton/elc-pb/elc-pb_programming-manual_4017452580.webp)
3 . I n s t r u c t i o n S e t
M N 0 5 0 0 3 0 0 3 E F o r m o r e
i n f o r m a t i o n
v i s i t :
w w w. e a t o n . c o m
3 - 4 11
API Mnemonic
Operands
Function
163
TSUB P
S
1
, S
2
, D
Calendar Data Subtraction
Bit Devices
Word devices
Program Steps
Type
OP
X Y M S K H KnX KnY KnM KnS T
C
D
E
F
S
1
*
*
*
S
2
*
*
*
D
*
*
*
TSUB, TSUBP: 7 steps
ELC ELCB
ELCM
PB PC/PA/PH
PV
PB PH/PA
32
16
P
32
16
P
32
16
P
32 16
P
32
16
P
Operands:
S
1
: Time Minuend
S
2
: Time Subtrahend
D
: Subtraction result
Operand
S
1
,
S
2
,
D
occupies 3 continuous addresses.
Description:
1.
S
1
−
S
2
=
D
. The time data in the registers specified by
S
2
is subtracted from the time data in
the registers specified by
S
1
and the result is stored in the registers specified by
D
.
2.
If the time data in
S
1
,
S
2
exceeds the allowable range, it will result in “operation error”. At this
time, the instruction won’t be executed and M1067=ON, M1068=ON, and error code 0E1A
(HEX) will be written to D1067.
3.
If the subtraction result is a negative value, the Zero flag M1020= ON. The value of the result
shown in
D
is the time remaining.
4.
If the subtraction result is equal to 0 (zero, 0 hour, 0 minute, 0 second), the Zero flag M1020=
ON.
5.
Besides using the TRD instruction, the MOV instruction can also be used to move the special
registers D1315 (Hour), D1314 (Minute), D1313 (Second) to the three registers specified to
read the current time of the clock/calendar.
Program Example:
When X0= ON, the instruction is executed. The time data specified by D10~D12 is subtracted from
the time data specified by D0~D2 and the result is stored in the register specified by D20~D22.
20:20:05
14:30:08
05:49:57
X0
TSUB
D0
D10
D20
D0 20(Hour)
D1 20(Min)
D2 05(Sec)
D20 05(Hour)
D21 49(Min)
D22 57(Sec)
D10 14(Hour)
D11 30(Min)
D12 08(Sec)
If the subtraction result is a negative value (less than 0), the borrow flag M1021= ON.
X0
TSUB
D0
D10
D20
05:20:30
19:11:15
10:09:15
D0 05(Hour)
D1 20(Min)
D2 30(Sec)
D20 10(Hour)
D21 09(Min)
D22 15(Sec)
D10 19(Hour)
D11 11(Min)
D12 15(Sec)
Содержание ELC-PB
Страница 1: ......
Страница 5: ...For more information visit www eaton com MN05003003E iv...
Страница 29: ...ELC Programming Manual For more information visit www eaton com MN05003003E 1 24 MEMO...
Страница 502: ...3 Instruction Set MN05003003E For more information visit www eaton com 3 333...
Страница 601: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 432...
Страница 625: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 456...