Read Real-Time Clock, Set Real-Time Clock Clock

Inputs/Outputs Operands Data Types

Memory Ranges ENO Errors Instruction Support for S7-200 CPUs SIMATIC/International Mnemonics
The Read Real-Time Clock instruction reads the current time and date from the clock and loads it in an 8-byte buffer starting at address T.

The Set Real-Time Clock instruction writes the current time and date to the clock beginning at the 8-byte buffer address specified by T.

In STL, the TODR and TODW instructions are represented as Time of Day Read (TODR) and Time of Day Write (TODW).

TODR: Error Conditions that Set ENO = 0:

SM4.3 (run-time), 0006 (indirect address), 000C (clock cartridge not present)

TODW: Error Conditions that Set ENO = 0:

SM4.3 (run-time), 0006 (indirect address), 0007 (TOD data error), 000C (clock cartridge not present)

The time-of-day clock initializes the following date and time after extended power outages or memory has been lost:



Day of Week:Sunday

The time-of-day clock in the S7-200 uses only the least significant two digits for the year, so for the year 2000, the year will be represented as 00 (it will go from 99 to 00).

You must code all date and time values in BCD format (for example, 16#97 for the year 1997). Use the following data formats:

Year/Monthyymmyy: 0 - 99mm: 1 - 12

Day/Hourddhhdd: 1 - 31hh: 0 - 23

Minute/Secondmmssmm: 0 - 59ss: 0 - 59

Day of Weekdd: 0 - 71 = Sunday

0 = disables day of week (remains 0)


The S7-200 PLC does not perform a check to verify that the day of week is correct based upon the date. Invalid dates, such as February 30, may be accepted. You should ensure that the date you enter is correct.

Do not use the TODR/TODW instruction in both the main program and in an interrupt routine. A TODR/TODW instruction in an interrupt routine that attempts to execute while another TODR/TODW instruction is in process will not be executed. SM4.3 is set indicating that two simultaneous accesses to the clock were attempted (non-fatal error 0007).

The S7-200 PLC does not use the year information in any way and will not be affected by the century rollover (year 2000). However, user programs that use arithmetic or compares with the year's value must take into account the two-digit representation and the change in century.

Leap year is correctly handled through year 2096.