DecodeEvent (FUN) ¶ FUNCTION DecodeEvent : EVENT This function serves to extract value eEvent of type _Event from parameter dwSpec of the callback function. InOut: Scope Name Type Comment Return DecodeEvent EVENT The EVENT of dwSpec Input dwSpec DWORD A combination of EVENT and EVENT_CLASS
EncodeSpec (FUN) ¶ FUNCTION EncodeSpec : DWORD This function servers to create the parameter dwSpec of type DWORD, which is necessary for callback functions, out of two values of type EVENT and EVENT_SOURCE . InOut: Scope Name Type Comment Return EncodeSpec DWORD Input eEvent EVENT Event to be used eClass EVENT_CLASS Event class to be used
Indirect Functioncall ¶ CallFunctionByIndex (Function)
CallFunctionByIndex (FUN) ¶ FUNCTION CallFunctionByIndex : __XWORD This function calls a function specified by their POU index keep in mind, that the called function is subject to a number of limitations: its name must begin with “Callback” its output value must be a DWORD on 32 bit and a LWORD on 64 bit systems. This can be achieved by using __XWORD. it must have exactly 3 input values with a data size of 4 bytes each on 32 bit and 8 bytes each on 64 bit systems. This can be achieved by using __XWORD. InOut: Scope Name Type Comment Return CallFunctionByIndex __XWORD Return value of the called function. Input pPOUFunc CAA.PVOID Pointer to function to call dwParam1 __XWORD prameter 1 dwParam2 __XWORD prameter 2 dwParam3 __XWORD prameter 3 peError POINTER TO ERROR
PostEvent (FUN) ¶ FUNCTION PostEvent : ERROR This function serves to trigger an event in order to call one ot multiple callbacks. The function returns immediately. The callbacks will be executed in the background. For this reason the function is suitable for triggering events e.g. in interrupt service routines. InOut: Scope Name Type Comment Return PostEvent ERROR An error code. Input eEvent EVENT event number eSource EVENT_SOURCE event source dwParam __XWORD parameter for called function
RegisterCallback (FUN) ¶ FUNCTION RegisterCallback : CAA.HANDLE With this function a new callback can be activated. The function with index iPOUIndex is called due to event e of class c from source s, if ( eEvent = CB.ALL_EVENTS OR eEvent = e ) AND (( eClass = CB.ALL_CLASSES ) OR ( eClass AND c ) > 0 ) AND ( eSource = CB.ALL_SOURCES OR eSource = s ) InOut: Scope Name Type Comment Return RegisterCallback CAA.HANDLE Handle of the new callback; 0 if not successful Input cbNew CB_CALLBACK callback description peError POINTER TO ERROR Pointer to an error ID
SendEvent (FUN) ¶ FUNCTION SendEvent : ERROR This function serves to trigger an event in order to call one or multiple callbacks with this event. It is recommended that IEC programs using this function do set CB_IECPROGRAM as event source and CB_ALL_CLASSES as event class. If the function is used by drivers, it is advisable to use CB_DRIVER as event source. The function will not return before all callbacks have been executed. Thus it is made sure, that all interested parties have terminated their respective reaction until the function returns. InOut: Scope Name Type Comment Return SendEvent ERROR An error ID Input eEvent EVENT event number eSource EVENT_SOURCE event source dwParam __XWORD parameter for called function
UnregisterCallback (FUN) ¶ FUNCTION UnregisterCallback : ERROR This function is used to unregister a callback InOut: Scope Name Type Comment Return UnregisterCallback ERROR An error ID Input hHandle CAA.HANDLE Handle of callback
Globale Constants ¶ GlobalConstants (GVL)
GlobalConstants (GVL) ¶ This constant can be used for the initialization of not used inputs of type CB_CALLBACK InOut: Scope Name Type Initial Constant gc_cbNULL CB_CALLBACK STRUCT(pPOUFunc := CAA.gc_pNULL, eEvent := EVENT.NO_EVENT, eClass := EVENT_CLASS.NO_CLASS, eSource := EVENT_SOURCE.NO_SOURCE)