Event class

Event classes are groups of events (possibly for a theme) and, in the sense of the TwinCAT type system, data types that can be used in different modules. For this reason they are created as data types in the TwinCAT type system (System > Type System > Event Classes).

Event class 1:

All known event classes are listed on the Event Classes tab in the TwinCAT type system. The TMC editor, in which the event classes can be defined and edited, can be opened via the context menu commands Edit and New.

In addition to the project event classes, TwinCAT also provides further event classes such as ADS return codes and system events.

Properties of event classes

Event class 2:

Name

This name designates the event class, for example in the generated source code.

Namespace

Like all data types, event classes may also belong to a namespace.

DisplayText

This text is used for the event class for the display. It can be internationalized (see Internationalization/translations).

Guid

Like all data types it identifies the currently described event class. It is calculated automatically and changes in the event of changes within the event class.

Event classes in PLC libraries

If event classes are used in a PLC library, they should also be part of the library in order to ensure that the data types are contained in the TwinCAT type system of every application that uses the PLC library.

To make this possible the event classes must be "pinned" in the PLC library. To do this, select the command Pin Global Data Type in the context menu of the created data type under External Types in the PLC library object.

Event class 3:

Event classes in C++ projects

Analogous to the other TwinCAT data types there is a possibility for C++ projects to define event classes locally in the C++ project.

Event class 4:

The event classes are declared for use in the corresponding C++ modules (irrespective of where they were defined). If an event class is added to a C++ module, it is automatically embedded in the TMC file of the module.

Event class 5: