Skip to main content

Tab: System Events

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.

List of mappings of functions to call to events with: Name, Description, Function to call, and Active (enable or disable the configuration)

Table 65. Add Event Handler

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 need to specify the name of the new function. CODESYS inserts the function to the device tree after you confirm the dialog.

Scope

  • Application: The function is available to the application.

  • POUs: The function is available to the entire project.

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

0: No error has occurred.

Does not equal 0: Error. You need to consult the respective runtime documentation.

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 line.

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 with an online 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 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 (Exit) all tasks.

Runtime main loop

No