Entry type: FAQ, Entry ID: 18630804, Entry date: 05/04/2012
(0)
Rate

How do you synchronize time/date between a TP170A and an S7-200 CPU with ProTool?

  • Entry
  • Associated product(s)

Instructions
Since only an unbuffered system clock is integrated in the TP170A 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:

Note
An example of each way of transferring date/time between TP170A and S7-200 controller is available for downloading at the end of the entry. The compressed file contains the library for synchronization for the STEP 7 Micro/WIN program and a ProTool project. 

Transfer the S7 CPU system time to the TP 170A

You can synchronize the system time on the TP 170A, 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.

Configuring in ProTool
Proceed as follows to insert the "Data/time PLC" area pointer:

  • In ProTool, right-click the "Area Pointer" item in the project window.
  • In the pop-up menu select the command "Insert area pointers...".
  • In the "Insert a new area pointer" dialog you mark the "Date/Time PLC" area pointer.
  • Click the "OK" button.
  • In the "Date/time PLC" dialog you set the parameters for the area pointer (Fig. 1).
  • Via the Acquisition Cycle you define the interval at which the system time in the TP 170A is updated with the current system time of the S7 CPU. It is recommended to set an acquisition cycle of at least 15 seconds.
  • Click the "OK" button.


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 Options project tree structure 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 ProTool project into your panel.


Fig. 02

Transfer a user-defined system time to the S7 CPU and TP 170A

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.

Configuring in STEP 7 Micro/WIN
Import the library in STEP 7 Micro/WIN (see 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 block and enter the initial address "VB 0", for example.


Fig. 03

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

Note:
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 included 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 settings in ProTool.

Configuring in ProTool
As described above, insert the "File > Library Memory..." area pointer into your ProTool project. Use the same data area as area pointer as for the global data of the block in STEP 7 Micro/WIN (see Fig. 03).


Fig. 05

In ProTool you define six variables of the data type "BYTE" for input of the date/time on the TP170A and one variable of the data type "BOOL" as trigger for transfer to the S7 CPU. In a picture with I/O fields you can assign values to the variables 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
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 TP170A project as archive file

Copy the "timesync.zip" file into a separate directory and then unpack the file. You can then integrate the library, which can be used in version V3.2.4.27 and higher of STEP 7 Micro/WIN, into your S7-200 project. You can open and use the TP170A project in ProTool V6.0 SP2 and higher.

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

  timesync.zip ( 14 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 4.0.2.26
HMI software ProTool V6.0 SP2 HF 2
HMI system -

Additional Keywords
Set time, Synchronize, Windows-based devices, WinCE, ProTool/Pro, ProTool/Lite