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?
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.
- In the source container you generate a new "STL source" and open it.
- 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.
- 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).
- 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).
- Compile the source.
- Insert the function block in "CFC", compile and load the "CFC". Transfer your project to "WinCC".
- Open a picture in the Graphics Designer.
- Insert an object (an IO field, for example) and open the Object Properties (Mark IO field > Right-click > Properties).
- 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)