Download project
This example implements and assembles an analogue clock, which shows the current system time, with standard visualization elements.
A clock with clock hands for hours, minutes and seconds is animated in the visualization.
FB_Clock
: The function block FB_CLOCK
implements the logic for getting the current time.
First a time zone is set and afterwards the time and date is fetched. Due to the fact that the parts like hour,
minute and second are needed, the date and time variable is split.
These parts can be used by the visualisation to show the time.
Visualization
: The Clock visualisation builds an analogue clock with several ellipses and polygons.
It is possible to make several references of this clock. Therefore a frame must be added in the main visualisation.
Right click on the frame and choose Frame Selection. There the visualisation can be selected.
For showing the time, a placeholder called FB_CLOCK
is defined in the Interface Editor of Clock_Visu
.
This variable is used to animate the clock hands.
By referencing the clock, the variable for the placeholder must be set in the Properties Editor at the References point.
In this way it is possible to reference more clocks e.g. with different time zones.
System requirements and restrictions | Info |
---|---|
Programming System | CODESYS Development System Version 3.5.14.0 or higher |
Runtime System | CODESYS Control Version 3.5.14.0 |
Required Accessories | - |