How do you synchronize the date and time between an S7-300/400 and OP3 (C7-621) with ProTool?
There are two options for synchronizing the date/time between an S7-300/400 and OP3.
- Transfer date and time from the CPU to the OP3.
- Transfer date and time from OP3 to the CPU.
The two types of synchronizing date/time between OP3 and S7-CPU are implemented in a STEP 7 project available for downloading at the end of this entry.
Communication between S7-CPU and OP3 is realized through the interface area that has to be inserted under area pointer in the ProTool project.
Fig. 01: Structure of the interface area
The Control and response bits, Date and Time areas are significant for time synchronization.
Transfer date and time from the S7-CPU to the OP3 (FC1 in the STEP 7 project)
In the Control and response bit area, Bit 2 of Byte n+0 signalizes the date/time request of OP3.
Fig. 02: Control/return information bits
Synchronization of the OP3 with the SIMATIC S7 is done in four steps:
- Every 15 minutes the OP3 sets Bit 2 in data byte n+0 of the interface area.
- When Bit 2 is set, the S7-CPU time must be read out of the CPU with the "READ_CLK" function and copied to the date/time folder of the interface area.
- As soon as the S7 program resets Bit 2 the OP3 recognizes that the S7 program has deposed current values for date and time in the interface area.
- The OP3 reads the current data from the data bytes n+15 to n+17 and n+21 to n+24 of the interface area and then sets the system time.
Fig. 03: Date and time folder
Transfer date and time from the OP3 to the S7-CPU (FC2 in the STEP 7 project)
If Bit 6 of Bytes n+0 of the Control and response bits is set, a new time has been set on the OP3. If Bit 5 of Byte n+0 of the Control and response bits is set, then the date has been changed on the OP3. The new values for date and time are stored in the date/time folder in the interface area. In the CPU the values must be copied into the corresponding tag area and then the CPU time must be set with the "SET_CLK" function. Bits 5 and 6 are reset after the CPU clock has been set.
More information is available in the OP3 device manual in Entry ID: 1142799.
Copy the "Clk_OP3.zip" file into a separate directory and then unpack the file. You can use the SIMATIC Manager to open and process the STEP 7 project. In order to process the OP3 project you must start ProTool with the option "STEP 7 integrated". The project was created with STEP 7 V5.2 SP1 and ProTool V6.0 SP2.
The download contains the function blocks described above and a sample call from organization block OB1.
Clk_OP3.zip ( 287 KB )
Runnability and test environment:
The following table lists the components that have been used to create this entry and verify the functions described.
|Components||Product and version designation|
|PC operating system||Microsoft Windows XP SP2|
|Engineering Tool||STEP 7 V5.2 SP1|
|HMI software||ProTool V6.0 SP2|
ProTool Lite, RMOS device