- Create a "Standard project" and select CODESYS Control Win V3 as the device.
- Define the target system by means of the Network scan.
- Insert an Alarm configuration in the device tree.
Here, the Error, Info and Warning alarm classes are created automatically, as well as the AlarmStorage object. In addition, another AlarmManagerTask is created.
Moreover, the AlarmManager library is added to the Library Manager:
Edit the PLC_PRG POU as follows:
Section Column width 7 Declaration
Column width 93 Code Block theme Confluence VAR xDemoAlarm : BOOL; sDateFormat : STRING := 'dd.MM.yyyy'; sTimeFormat : STRING := 'HH:mm:ss'; END_VAR
Section Column width 7 Implementation
Column width 93 Code Block theme Confluence AlarmManager.g_sDateFormat := sDateFormat; AlarmManager.g_sTimeFormat := sTimeFormat;
- Insert a visualization in the device tree.
Then the Visualization Manager is inserted automatically with the TargetVisu and WebVisu visualization types.
In addition, another VISU_TASK is created. - In the Visualization, set an element of type Alarm Table and configure the element as follows:
- Insert an alarm group in the Alarm configuration and configure an alarm as follows:
- Start the project and set the variablexDemoAlarm to TRUE.
Now, if you change the formatting of the constants, the default will be accepted when the alarm is triggered again.
The 'yyyy/MM/dd' and 'HH:mm tt' specifications result in a rotated date and a time display without seconds in English style.Milliseconds can be specified with "ms":