Delta DVP-ES2 — 3.8 Detailed Instruction Explanation

DVP-ES2/EX2/SS2/SA2/SX2/SE&TP Operation Manual - Programming Operands: S 1 : Time minuend (occupies 3 consecutive devices) S 2 : Time subtrahend (occupies 3 consecutive devices) D : Subtraction result (occupies 3 consecutive devices) Explanations: 1. TSUB instruction subtracts 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 subtraction result is a negative value (less than 0), Borrow flag M1020 = ON and the value in D will be the result of “the negative value pluses 24 hours”. 4. If the subtraction result (remainder) equals 0 (00:00:00), Zero flag M1020 will be ON. 5. Besides using TRD instruction, MOV instruction can also be used to move the RTC value to D1315 (Hour), D1314 (Minute), D1313 (Second) for reading the current time of RTC.. Program Example: When X0 = ON, TSUB instruction executes and the time value in D0~D2 is subtracted by the time value in D10~D12. The subtraction result is stored in D20~D22.

X0 D20 05(Hour) D21 49(Min) D22 57(Sec) 20:20:05 14:30:08 05:49:57 3-416 API Mnemonic Operands Function Controllers 163 TSUB P Time subtraction 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 TSUB, TSUBP: 7 steps S 1 * * * S 2 * * * D * * * 16-bit 32-bit SA2 SA2 ES2/EX2 SS2 SA2 SE SX2 SS2 SX2 ES2/EX2 SS2 SX2 SE SE TSUB D0 D10 D20 D0 20(Hour) D1 20(Min) D2 05(Sec) D10 14(Hour) D11 30(Min) D12 08(Sec)