Object: “Task Configuration”
On the “System Events” tab, you define which event calls which function 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 |
“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. |
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 possible selection 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 have to specify the name of the new function. CODESYS inserts the function to the device tree after you confirm the dialog. |
“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 task safe section and only for an online change change (for example, the copy code for online change is executed here). |
Communication task |
No |
Exception |
The event is sent if an exception has occurred in the context of an application. |
Exception handling task of the runtime, or the task itself if the runtime does not support exception handling |
Depends on the task |
Login |
Login of a client to this application |
Communication task |
No |
Logout |
Logout of 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 outputs |
IEC task |
Yes |
AfterWritingOutputs |
Call after writing the outputs |
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 main loop |
No |
PrepareExitComm |
Event is sent during download before exiting the communication server. |
Runtime main loop |
No |
PrepareExitTasks |
Event is sent during download before exiting all tasks. |
Runtime main loop |
No |