Tab ‘System Events’¶
Object: Task Configuration
In the System Events tab, you define which events call which functions and whether or not the configuration is currently activated. You use this tab when a system event (instead of a task) should call a project function.
Add Event Handler | Opens the Add Event Handler dialog box |
Remove Event Handler | Deletes the selected list assignment |
Event Info | Shows information from the corresponding event library |
Open Event Function | Opens the editor of the new function for the selected assignment You have selected the implementation language of the new function in the Add Event Handler dialog box. |
Assignment of functions to call for events with: Name,Description, Function to call, and Active (activate/deactivate configuration). |
Adds a new assignment “Event – Function to call” to the list | |
Event | The list of choices depends on the target device. CODESYS marks unavailable events with a red symbol in front of the name. A list of all possible system events is located at the end of this section. |
Function to call | Function name (POU, type FUNCTION) You must enter the name of the new function. CODESYS inserts the function to the device tree after you confirm the dialog box. |
Scope |
|
Implementation language | Implementation language for the new function |
Description | Short description of the selected event |
Features in Online Mode
The list of assignments from called functions to events also includes the following information: Event Status, Call Count, and the Online Reset button.
Event Status |
Does not equal |
Call Count | Displays how often the event has occurred or the associated function has been called. |
Online Reset | CODESYS reinitializes the event lists and resets the counter for the events/function calls. Incorrectly initialized events are displayed with a red status cell. |
Possible system events
Event | Description | Task | Debugging |
---|---|---|---|
PrepareStart | Call before starting the application | Communication Task | no |
StartDone | Call after starting the application | Communication Task | no |
PrepareStop | Call before stopping the application | Communication Task | no |
StopDone | Call after stopping the application | Communication Task | no |
PrepareReset | Call before resetting the application | Communication Task | no |
ResetDone | Call after resetting the application | Communication Task | no |
PrepareOnlineChange | Call before online change of the application | Communication Task | no |
OnlineChangeDone | Call after online change of the application | Communication Task | no |
PrepareDownload | Call before downloading the application | Communication Task | no |
DownloadDone | Call after downloading the application | Communication Task | no |
PrepareDelete | Call before deleting the application | Communication Task | no |
DeleteDone | Call after deleting the application | Communication Task | no |
PrepareExit | Call before exiting the application | Communication Task | no |
ExitDone | Call after exiting the application | Communication Task | no |
CodeInitDone | Event is sent after Code Init. Called within the safe section task and only for online change (for example, the copy code is executed here for online change). | Communication Task | no |
Exception | The event is sent if an exception has occurred in the context of an application. | Exception Handling Task (of runtime system) or task itself (if the runtime system does not support exception handling) | Depends on the task |
Login | Logs in a client to this application | Communication Task | no |
Logout | Logs out a client from this application | Communication Task | no |
BeforeReadingInputs | Call before reading the inputs | IEC Task | yes |
AfterReadingInputs | Call after reading the inputs | IEC Task | yes |
BeforeWritingOutputs | Call before writing the inputs | IEC Task | yes |
AfterWritingOutputs | Call after writing the inputs | IEC Task | yes |
DebugLoop | Event is sent in cycles to the debug loop if the IEC task stops at a breakpoint. | Communication Task | no |
PrepareShutdown | Event is sent immediately before the runtime system is downloaded. | Runtime System Main Loop | no |
PrepareExitComm | Event is sent during download before exiting the communication server. | Runtime System Main Loop | no |
PrepareExitTasks | Event is sent during download before exiting all tasks. | Runtime System Main Loop | no |