274
4
4 Instructions4.8.4 Clock Read/Write
Example:
Operation:
Item System Variable D After Operation
Year (2000–2099) D8018 → D0
Month (1–12) D8017 → D1
Date (1–31) D8016 → D2
Hours (0–23) D8015 → D3
Minutes (0–59) D8014 → D4
Seconds (0–59) D8013 → D5
Day (0–6: Sun–Sat) D8019 → D6
Note: When you need to use the internal real-time clock of the PLC is used, use the TDR instruction to read
the current time and date of the clock and store them in registers from head address D. Do not use the data
stored in D8013 to D8019 directly.
TWR: Clock data write
◆
Overview
The TWR instruction sets the internal real-time clock of the PLC to a time value represented in year, month,
date, hours, minutes, seconds, and day, which are stored from head address S.
TWR D
Clock data write Applicable model:
H3U
S
Time
and date
storage
head
address
Head address of seven consecutive variable units that store
the year, month, date, hours, minutes, seconds, and day from
the smallest to largest addresses
16-bit instruction
(3 steps)
TWR: Continuous
execution
TWRP: Pulse
execution
◆
Operands
Operand
Bit Element Word Element
System·User System·User Bit Designation Indexed Address Constant
Real
Number
S X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
Note: The elements in gray background are supported.
◆
Function
The internal real-time clock of the PLC is set to a time value represented in year, month, date, hours, minutes, seconds,
and day, which are stored from the head address S.
S is the head address of seven consecutive variable units that store the year, month, date, hours, minutes, seconds, and
day from the smallest to largest addresses.
Example 1:
Operation: