7 APPLICATION INSTRUCTION
7.19 Clock instruction
581
7
Writing clock data
TWR(P)
This instruction writes the clock data to the built-in CPU module real time clock.
■Descriptions, ranges, and data types
■Applicable devices
• These instructions write the clock data stored in device numbers (s) to (s)+6 to the clock data area (SD210 to SD216 and
SD8013 to SD8019) of the built-in real time clock in the CPU module.
• Executing these instructions immediately changes the real time clock data. Therefore, transfer the clock data of a few
minutes ahead the current time to the clock data area (s) to (s)+6 in advance. Execute the instruction when the actual time
matches the clock data time.
• When using these instructions to set the clock data (i.e., performing time adjustment), control of special relay SM8015
(clock stop/adjustment) is not required.
• If incorrect values (i.e., values out of range) are set to the write source area, the clock data will not be updated. In this case,
correct the clock data in the write source area and execute the instruction.
• Day of the week (SD216 and SD8019) is automatically corrected.
Ladder diagram Structured text
ENO:=TWR(EN,s);
ENO:=TWRP(EN,s);
Operand Description Range Data type Data type (label)
(s) Head device number where the clock write source data is stored 16-bit signed binary ANY16
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB
U\G T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U\G Z LC LZ K, H E $
(s)
Time setting data Special registers
Device Item Clock data Device Item
(s) Year 1980 to 2079 (year, four digits) SD210, SD8018 Year
(s)+1 Month 1 to 12 SD211, SD8017 Month
(s)+2 Day 1 to 31 SD212, SD8016 Day
(s)+3 Hour data 0 to 23 SD213, SD8015 Hour data
(s)+4 Minute data 0 to 59 SD214, SD8014 Minute data
(s)+5 Second data 0 to 59 SD215, SD8013 Second data
(s)+6 Day-of-the-week data 0 (Sunday) to 6 (Saturday) SD216, SD8019 Day-of-the-week data