beautypg.com

Delta DVP-ES2 User Manual

Page 496

background image

D V P - E S 2 / E X 2 / S S 2 / S A2 / S X 2 / S E O p e r a t i o n M a n u a l - P r o g r a m m i n g

3 - 3 8 0

API Mnemonic

Operands

Function

163

TSUB P

Time subtraction

Controllers

ES2/EX2 SS2 SA2

SE

SX2

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

PULSE 16-bit 32-bit

ES2/EX2 SS2

SA2

SE

SX2 ES2/EX2 SS2

SA2

SE

SX2 ES2/EX2 SS2

SA2

SE

SX2

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.

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), Borrow flag M1021 = ON.

This manual is related to the following products: