3. Instruction Set
API
Mnemonic Operands Function
162 TADD P
Time addition
Type
OP
Bit Devices Word devices Program Steps
X Y M S K H KnX
KnY
KnM
KnS
T C D E F
TADD, TADDP: 7 steps
SS2
SX2
SS2
SX2
SS2
SX2
Operands:
S
1
: Time augend (occupies 3 consecutive devices) S
2
: Time addend (occupies 3 consecutive
devices) D: Addition result (occupies 3 consecutive devices)
Explanations:
1. TADD instruction adds the time value (Hour, Minute Second) S
1
with the time value (Hour,
Minute Second) S
2
and stores the result in D.
2. If operand S
1
, S
2
exceed the available range, operation error occurs and M1067 = ON, M1068
= ON. D1067 stores the error code 0E1A (HEX).
3. If the addition result is larger than 24 hours, the carry flag M1022 will be ON and the value in D
will be the result of “sum minuses 24 hours”.
4. If the sum equals 0 (00:00:00), Zero flag M1020 will be ON.
Program Example:
When X0 = ON, TADD instruction executes and the time value in D0~D2 is added with the time
value in D10~D12. The addition result is stored in D20~D22.
08:10:20 06:40:06 14:50:26
X0
TADD
D0 D10 D20
D0 08(Hour)
D1 10(Min)
D2 20(Sec)
D20 14(Hour)
D21 50(Min)
D22 26(Sec)
D10 06(Hour)
D11 40(Min)
D12 06(Sec)
If the addition result is greater than 24 hours, the Carry flag M1022 = ON.
X0
TADD
D0 D10 D20
18:40:30 11:30:08 06:10:38
D0 18(Hour)
D1 40(Min)
D2 30(Sec)
D20 06(Hour)
D21 10(Min)
D22 38(Sec)
D10 11(Hour)
D11 30(Min)
D12 08(Sec)