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)
Structs ¶ CB_CALLBACK (Struct)
CB_CALLBACK (STRUCT) ¶ TYPE CB_CALLBACK : STRUCT This data structure describes the callback conditions and -function. Attributes: qualified_only InOut: Name Type Initial Comment pPOUFunc CAA.PVOID CAA.gc_pNULL Address of the function to be called eEvent EVENT EVENT.ALL_EVENTS Trigger event or CB_ALL_EVENTS eClass EVENT_CLASS EVENT_CLASS.NO_CLASS Event class (mask) eSource EVENT_SOURCE EVENT_SOURCE.NO_SOURCE Event source