3. Instruction Set 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. X0 08:10:20 06:40:06 14:50:26 If the addition result is greater than 24 hours, the Carry flag M1022 = ON. X0 18:40:30 11:30:08 06:10:38 3-415 API Mnemonic Operands Function Controllers 162 TADD P Time addition ES2/EX2 SS2 SA2 SX2 SE Typ e 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 S 1 * * * S 2 * * * D * * * PULSE 16-bit 32-bit SA2 S SE SA2 ES2/EX2 SS2 SA2 SE SX2 ES2/EX2 SS2 X2 ES2/EX2 SS2 SX2 SE TADD D0 D10 D20 D0 08(Hour) D10 06(Hour) D20 14(Hour) D1 10(Min) D11 40(Min) D21 50(Min) D2 20(Sec) D12 06(Sec) D22 26(Sec) TADD D0 D10 D20 D0 18(Hour) D10 11(Hour) D20 06(Hour) D1 40(Min) D11 30(Min) D21 10(Min) D2 30(Sec) D12 08(Sec) D22 38(Sec)