beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 517

background image

9 Application Instructions API 150-199

DVP-PLC Application Manual

9-45

API Mnemonic Operands

Function

167

TWR P

Time Write

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

*

*

*

TWR, TWRP: 3 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: Device for storing the new time to be written into RTC

Explanations:

1.

S will occupy 7 consecutive devices.

2.

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

3.

Flags: M1016, M1017, M1076. See remarks of API 166 TRD for more details.

4.

To make adjustment on the RTC built in EH/EH2/SV/SA/SX/SC series MPU, use this instruction to write the

correct time into the RTC.

5.

When this instruction is executed, the new set time will be written in the RTC built in PLC immediately.

Therefore, please be noted that the new set time has to match the current time then when the instruction is

executed.

6. If

S exceeds its range, the program will regard it as an operation error and the instruction will not be executed.

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

Program Example 1:

When X0= On, write the correct current time into the RTC.

TWRP

X0

General D

Item

Content

Special D

Item

D20 Year

(A.D.)

00~99

D1319 Year

(A.D.)

D21

Day

(Mon ~ Sun)

1~7

D1318

Day

(Mon ~ Sun)

D22 Month

1~12

D1317 Month

D23 Date

1~31

D1316 Date

D24 Hour

0~23

D1315 Hour

D25 Minute

0~59

D1314 Minute

Ne

w set time

D26 Second

0~59

D1313 Second

Real Tim

e

Cl
ock

Program Example 2:

1.

Set the current time in the RTC as 15:27:30, Tuesday, August 19, 2003.

2.

D0 ~ D6 indicate the new set time in the RTC.

3.

X10 = On for changing the current time in the RTC and make the changed value the new set value.