Entry type: FAQ, Entry ID: 23562916, Entry date: 06/28/2006

How do you use ProTool to synchronize the data and time between a SIMATIC HMI panel and a SIMOTION controller?

  • Entry
  • Associated product(s)
Date and time synchronization between ProTool and SIMOTION Scout takes place via external tags. The SIMOTION system time is read out cyclically in a SIMOTION program and transferred into ProTool via the configured tags. Synchronization takes place via script functions in both directions.

Proceed as follows.

No. Procedure

Create a SIMOTION project
The requirement for date and time synchronization is an opened project with a SIMOTION device set up.


Fig. 01

A new device or further devices can be added in the project menu via "Create new device".


Create/import a structured program in SIMOTION Scout
In the project menu, add a new ST program in the "Programs" folder for the device created.


Fig. 02

Alternatively, you can also download the Uhr.zip file and import the unpacked file "Uhr.st" via the pop-up menu (right-click on "Programs"). Select "Import external source" and "ST source file" in the pop-up menu.


Fig. 03
3 Create global tags and program
Global tags are required for data exchange between ProTool and the SIMOTION Scout. The system time can be read or set with the aid of the ReadClock and SetClock functions which are created.


Fig. 04

The ReadClock and SetClock functions are of the RTC type. When these functions are called, explicit parameters must be transferred to enable the corresponding functions to be executed. The current system time can be read by calling the CDT method.

Identifier Parameter Data type Description
SET Input Bool Set time; default FALSE
READ Input Bool Read time; default FALSE
PDT Input DT Value to which the real-time clock should be set; default DT#0001-01-01-00:00:00. If the value is lower than the default for the real-time clock on the SIMOTION device, the real-time clock is set to its default ( (for example, in the case of C320-2: DT#1994-01-01-00:00:00).
CDT Output DT Current system time

With the following function call the system time is read and the current time is transferred via the CDT method:

ReadClock( FALSE, TRUE, DT#2005-01-01-0:0:0 );
ReturnValue = ReadClock.CDT;

The structured program can be tested for syntax errors via "ST source file > Accept and compile" or by clicking the following icon on the toolbar.


Accept and compile
4 Define the program call in the execution system
The program which is created in or imported into SIMOTION Scout also has to be defined as a background task in the execution system.
  • This is done by clicking "EXECUTION SYSTEM" in the project tree and selecting "ExecutionLevels > OperationLevels > BackgroundTask".
  • Select the "Uhr.clock( )" program and add it by clicking the "Add" button.


Fig. 05

You can then compile your SIMOTION configuration and transfer it to the SIMOTION device.

5 Create a SIMOTION connection in ProTool
The connection with the SIMOTION device must be defined in ProTool.

In the project tree you double-click "Controllers" to create a new connection and select the "SIMOTION V6.0" protocol. Click the "Parameters..." button (2) in the selection window.

In the "SIMOTION" dialog that opens, under "Connect OP to network" you select the PROFIBUS subnet (3) to which the panel is connected as hardware. Then you select the SIMOTION device under "Choose a communication peer/symbol list" (4).


Fig. 06

In ProTool, the "Date/time PLC" area pointer for synchronizing the system clock in a SIMOTION device cannot be used because the ProTool data type "DATE_AND_TIME" is different from the SIMOTION data type.

6 Add tags for time synchronization
In the project tree, under "Tags" you create all the tags required:
  • Uhr.set
  • Uhr.time_panel
  • Uhr.time_plc


Fig. 07
7 Create a script
  • Add a new script named "SetPanelClk".
  • Create six script tags (second, minute, hour, day, month, year) in the Script Editor and, using the appropriate VBS functions (for example, Day, Month, etc.), assign the relevant time base via the external tag "Uhr.time_plc".

The system time of the panel can be changed via the (CMD) console with the Windows "Date" and "Time" operating system functions. The Windows console is called via the script functions "Call" and "Start_PtFct.Program".


Fig. 08

Depending on which location has been selected, dots or dashes must be selected as separator characters in the date details.

Description of the "Start_program" function:
The instructions for ProTool functions are indicated in the Script Editor with the identifier "PtFct", separated by a point. The structure of the "Start_program" function is defined as follows:   

PtFct.Programm_starten (<ProgName>, <Param>, <Layout>, <Wait>)

Parameter Meaning Description
ProgName Name of the program String constant or tag containing the name of the program
Param Program parameter String constant or tag containing the name of the program parameter(s)
Layout Display options 0 = window
1 = minimized
2 = maximized
3 = minimized and inactive
Wait Wait for the end 0 = off
1 = on

The script can be checked for syntax errors by clicking the "Compile" button in the Script Editor.


Create a further script

  • Create a second script and rename it "Clk_sys_in_var".
  • Use the keyword "Now" to assign the "Uhr.time_panel" tag which has already been created.

The "Now" function delivers the current system date and time for the panel or PC.


Fig. 09
9 Create screens and objects
Create two buttons, two date-time fields, as well as (optionally) an alarm view with system messages as an alarm event in a new screen.


Fig. 10
The alarm view is merely used as a configuration aid. Among other things, the system message, which must be explicitly configured, appears in this display to indicate whether the SIMOTION device is connected to the panel.
10 Link tags
Then connect the upper date/time field to the "Uhr.time_plc" tag which you created previously. Select "Display system time" in the lower date/time field.


Fig. 11    
11 Link the script to the buttons
  • Link the "Clk_sys_in_var" script in the Properties of the "Time Panel > CPU" under "Functions > Click".
  • Also create the "SetBit" function and link the "Uhr.set" tag.
  • Link the second script "SetPanelClk" to the "Time CPU > Panel" button applying the same principle as with the first button.


Fig. 12

You can now transfer the configuration to the panel or start the PC runtime.

Download the structured SIMOTION program
This file contains the "Uhr.st" file which can be imported into SIMOTION Scout V3.2.1.

 Registration required Uhr.zip (1 KB)

Download the sample project
The packed file contains the SIMOTION ProTool project which is described in the instructions. The ProTool project requires ProTool version V6.0 SP3.  

 Registration required Simotion_ProTool.zip (450.8 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 SIMOTION Scout V 3.2.1
HMI Software ProTool V6.0 SP3
HMI System -
SIMOTION device C230

Additional Keywords
Date synchronization, Time synchronization