Inserting Callbacks (EXAMPLE)

( CAA_Callback.Library)

The following code lines insert two callbacks. The first calls function BeforeResetFunction, which is called before the PLC is reset; the second calls function ErrorFunction as soon as an event of class RTS_ERRORS or SYSTEM_EXCEPTIONS occurs.

 

cbNew.eEvent := CB.BEFORE_RESET;

cbNew.eClass := CB.ALL_CLASSES;

cbNew.eSource := CB.ALL_SOURCES;

cbNew.pPOUFunc := ADR(CallbackBeforeReset);

CB.RegisterCallback(cbNew);

 

cbNew.eEvent := CB.ALL_EVENTS;

cbNew.eClass := CB.RTS_ERRORS OR CB.SYSTEM_EXCEPTIONS;

cbNew.eSource := CB.ALL_SOURCES;

cbNew.iPOUFunc := ADR(CallbackError);

CB.RegisterCallback(cbNew);