How do you synchronize the date and time between an OP3 and an S7-200 CPU?
There are two possibilities for synchronizing date/time between a S7-200 and the OP3:
The communication between the S7-200 and the OP3 is implemented within the interface area that has been entered in the ProTool project.
For time synchronization purposes, the areas control and response bits date and time are relevant.
In the control and response bits area, bit 2 signalized the date/time request of the OP.
The synchronization of the OP 3 with the SIMATIC S7 is carrie out in four steps:
- Every 15 minutes the OP 3 sets the bit 2 in the data byte n+0 on 1.
- If bit 2 is set, the CPU time has to be read with the function "READ_RTC" from the S7-200 and be copied into the date and time area of the interface area.
- As soon as the S7 program resets bit 2, the OP 3 recognizes that the S7 program has stored the current values for time and date in the interface area.
- The OP 3 reads out the recent data from data bytes n+15 to n+17 and n+21 to n+24 of the interface area.
Transfer date/time from the OP3 to the S7-200
If bit 6 of bytes n+0 of the control and response bit has been set, a new time was set on the OP. If bit 5 of Byte n+0 of the control and response bit is set, the date on the OP was changed. The new values for date and time are stored in the interface area of the date/time folder. For the S7-200, the values have to be copied back into the appropriate variable area and the setting for the CPU time have to be made with the funciton "SET_RTC". Bits 5 and 6 must be reset after setting the CPU clock.
- Further information can be found in the manual of the OP3 under entry ID 1142799.
The STEP 7 Micro/WIN library as archive file:
Copy the "timeop3.zip" file into a separate directory and unpack the file. You can then integrate the library, which can be used in version V184.108.40.206 and higher of STEP 7 Micro/WIN, into your S7-200 project.
Time_OP3.zip ( 2 KB )
Information on how to insert libraries in STEP 7 Micro/WIN is available in Entry ID 16689345.