Entry type: FAQ, Entry ID: 19323674, Entry date: 11/29/2007

How do you synchronize date/time between a TP170A / TP170micro / TP177micro and an S7-200 CPU with WinCC flexible?

  • Entry
  • Associated product(s)

Since only an unbuffered system clock is integrated in TP170A, TP170micro and TP177micro, the panel's system clock can only be synchronized at regular intervals with the system clock of the S7-200 controller using the "Date/time PLC" area pointer.

You have two options:

An example of the two transfer methods mentioned above is available at the end of this entry in the form of a compressed file. It contains a block (library) for the STEP 7 Micro/Win program and WinCC flexible projects for the relevant panels.

Transfer the CPU system time to the panel

You can synchronize the system time on the panel, which is used for time stamping incoming operation messages among other things, to the system time of the controller using the "Date/time PLC" area pointer (see Fig. 01). In the case of panels that do not have the "Date/time PLC" area pointer, this is not presented as a choice in WinCC flexible.

Configuring in WinCC flexible
Insert the "Date/time PLC" area pointer by parameterizing the area pointer's connection in the "Area pointer" tab (Fig. 01). Then define the initial address of the area pointer, e.g. "VB 0", in which the system time is to be transferred from the S7-200 to the panel. Via the Acquisition Cycle you define the interval at which the system time in the Touch Panel is updated with the current system time of the CPU. It is recommended to set an acquisition cycle of at least 10 seconds.

Fig. 01

In order to be able to read out the system time of the S7-200 you need the READ_RTC block from the project tree instructions of STEP 7 Micro/WIN.

Configuring in STEP 7 Micro/WIN
In your STEP 7 Micro/WIN program you call the READ_RTC function for reading out the system time. You assign the address of the area pointer to the T parameter. Finally you load the sample WinCC flexible project into your panel.

Fig. 02

Transferring a user-defined system time to the CPU and the panel

If you want to synchronize the time between panel and S7-200 and want to change the time via the panel, you must use the "Timesynch_TP170A_micro" (v1.1) block that is included in Attachment 1 at the end of this entry.

In the following we explain the implementation of the "Timesynch_TP170A_micro" block for synchronizing between S7-200 and panel.

Configuration in STEP 7 Micro/WIN
Import the library in STEP 7 Micro/WIN (Attachment 1).  Information on inserting libraries in STEP 7 Micro/WIN is available in Entry ID: 16689345.

Define the global memory area for the synchronization area by opening "File > Library Memory...". Select the "Timesynch_TP170A_micro" (v1.1) block and enter the initial address "VB 0", for example.

Fig. 03

Use the updated version of the synchronization block from the "Timesynch_TP170A_micro (v1.1)" library.

You can verify the block version by marking the block in the library and right-clicking to open the pop-up menu. Then select "Properties...". The latest version of the block is displayed under "Version Library". With version v1.1 the version number is also given in the block comment.

Integrate the time synchronization block into the program (e.g. "MAIN (OB1)") and define the parameters (variables) for the block. You activate the block via the input "EN" that must be interconnected in the S7-200 program, e.g. with "LD SM0.0".
The variables used in this example (VB12-VB19) are for setting the system time of the S7-200. Marker M1.1 acts as trigger bit for transfer to the CPU. The second marker is only required for internal operations.

Fig. 04

In order to be able to change the system time of the S7-200 via the panel you must make the following settings in WinCC flexible.

Configuring in WinCC flexible
As described above, insert the "Date/time PLC" area pointer into your WinCC flexible project. For the area pointers use the same data area that you used for the block's global data in STEP 7 Micro/WIN (see Fig. 03).

Fig. 05

In WinCC flexible you define six variables of the data type "Byte" for input of the date/time on the panel and one variable of the data type "Bool" as trigger for transfer to the CPU. On the panel you can assign values to the variables via I/O fields and set/reset the trigger bit (M1.1) via a button. Display of the input field on the panel must be hexadecimal.

Fig. 06

Note that in the case of changing the system clock via the panel the update time can take several seconds. This depends on the baud rate among other things.

The STEP 7 Micro/WIN library and the WinCC flexible project as archive file
Copy the "timesync.zip" file into a separate folder and then unpack the file. You can then integrate the library, which can be used in version V4 and higher of STEP 7 Micro/WIN, into your S7-200 project. You can open and use the HMI project in WinCC flexible 2004 and higher.

Information on inserting libraries in STEP 7 Micro/WIN is available in Entry ID: 16689345.


  • For STEP 7 Micro/WIN V4.0 the SP 5 is available for downloading free of charge in Entry ID: 24675347 .

Attachment 1: timesync.zip ( 5624 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
Standard tools  
Engineering tools STEP 7 Micro/WIN
HMI software WinCC flexible 2005 SP1
HMI system -

Setting the clock, Synchronize, Synchronization