Clock Instructions - Siemens Simatic S7-200 System Manual

Hide thumbs Also See for Simatic S7-200:
Table of Contents

Advertisement

Clock Instructions

Read Real-Time Clock and Set Real-Time Clock
The Read Real-Time Clock (TODR) instruction reads the current
time and date from the hardware clock and loads it in an 8-byte
Time buffer starting at address T. The Set Real-Time Clock (TODW)
instruction writes the current time and date to the hardware clock,
beginning at the 8-byte Time buffer address specified by T.
You must code all date and time values in BCD format (for example,
16#97 for the year 1997). Figure 6-3 shows the format of the Time
buffer (T).
The time-of-day (TOD) clock initializes the following date and time
after extended power outages or when memory has been lost:
Date:
01–Jan–90
Time:
00:00:00
Day of Week:
Sunday
Error conditions that set ENO = 0
H 0006 (indirect address)
H 0007 (TOD data error) Set Real-Time Clock only
H 000C (clock not present)
Table 6-8
Valid Operands for the Clock Instructions
Inputs/Outputs
T
T
Year:
Month:
00 to 99
01 to 12
Figure 6-3
Format of the 8-Byte Time Buffer (T)
Tip
The S7-200 CPU does not perform a check to verify that the day of week is correct based upon the
date. Invalid dates, such as February 30, could 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 cannot be executed. SM4.3 is set indicating that two simultaneous accesses to
the clock were attempted (non-fatal error 0007).
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 is represented as 00. The S7-200 PLC does not use the year information in any way.
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.
Data Types
Operands
BYTE
IB, QB, VB, MB, SMB, SB, LB, *VD, *LD, *AC
T+1
T+2
T+3
Day:
Hours:
01 to 31
00 to 23
S7-200 Instruction Set
T+4
T+5
T+6
Minutes:
Seconds:
0
00 to 59
00 to 59
*T+7
Chapter 6
T+7
Day of Week:
0 to 7*
1=Sunday, 7=Saturday
0 disables the day of week.
73
6

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents