beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 513

background image

9 Application Instructions API 150-199

DVP-PLC Application Manual

9-41

API Mnemonic

Operands

Function

162

TADD P

Time Addition

Controllers

ES/EX/SS SA/SX/SC EH/SV

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

*

*

*

TADD, TADDP: 7 steps

PULSE 16-bit 32-bit

ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV

Operands:

S

1

: Time summand S

2

: Time addend D: Time sum

Explanations:

1.

S

1

, S

2

, and D will occupy 3 consecutive devices.

2.

See the specifications of each model for their range of use.

3.

Flags: M1020 (zero flag); M1022 (carry flag)

4.

S

1

+ S

2

= D. The hour, minute, and second of the RTC designated in S

1

plus the hour, minute, and second

designated in S

2

. The result is stored in the hour, minute, and second of the register designated in D.

5. If

S

1

and S

2

exceed their ranges, the program will regard this as an operation error and the instruction will not

be executed. M1067 and M1068 will be On and D1067 record the error code 0E1A (hex).

6.

If the sum 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”.

7.

If the sum equals 0 (00:00:00), the zero flag M1020 will be On.

Program Example:

1.

When X10= On, TADD instruction will be executed and the hour, minute and second in RTC designated in D0

~ D2 will plus the hour, minute and second in RTC designated in D10 ~ D12. The sum is stored in the hour,

minute and second of the register designated in D20 ~ D22.

X10

TADD

D0

D10

D20

8

20

6

40

6

14

26

50

10

08:10:20

06:40:06

14:50:26

2.

If the sum is larger than 24 hours, M1022 will be On.

X10

TADD

D0

D10

D20

30

11

30

8

6

38

10

40

18:40:30

11:30:08

06:10:38

18