×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 1085941, Entry date: 08/24/2011
(0)
Rate

How do you read out the system time of the CPU and convert it into a format that you can transfer to "WinCC" and have it displayed there?

  • Entry
  • Associated product(s)
The blocks described in this entry read out the system time and convert the minutes, hours, etc. into the data type "String" or the data type "Integer". You can then transfer the corresponding function block to "WinCC" where you can access the variables.
Warning
The calendar year is given as two digits. You have to ensure the transition from 99 to 00 (from 1999 to 2000, for example) in the subsequent programming.

Procedure

  1. In the source container you generate a new "STL source" and open it.
  2. Copy the source text (see below) for the conversion into either data type "String" (FUNCTION_STRING) or data type "Integer" (FUNCTION_INT) and change the number of the function block.
  3. Insert the system function "SFC1" (Read System Clock) in the "CFC" and delete the system function again ("SFC1" is now in the block container Offline).
  4. For conversion into the data type "String": Insert the function "FC16" (I_STRNG) in the "CFC" and delete the function again (the function is now in the block container Offline).
  5. Compile the source.
  6. Insert the function block in "CFC", compile and load the "CFC". Transfer your project to "WinCC".
  7. Open a picture in the Graphics Designer.
  8. Insert an object (an IO field, for example) and open the Object Properties (Mark IO field > Right-click > Properties).
  9. Link the "Output value" property with the variable.

STL block for the data type "STRING". This example works with symbolic programming:
FUNC_STRING_SYMBOLIC.txt (3 KB)

STL block for the data type "INT". This example works with symbolic programming:
FUNC_INT_SYMBOLIC.txt (1 KB)

Additional Keywords
Time-of-day synchronization

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.