ETrigToTlA (FB) ¶ FUNCTION_BLOCK ETrigToTlA IMPLEMENTS IFBCommand Serves as a basis for E dge Trig gered, T ime o ut constrained, T ime l imited, A bortable function blocks InOut: Scope Name Type Comment Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. xAbort BOOL TRUE : Action is stopped immediately and all outputs are reset to their initial values. udiTimeLimit UDINT Defines how long (µs) an FB (requiring a long time for complete processing) may run until it is forced to return to the calling POU. The value 0 means that there is no time limitation. udiTimeOut UDINT Defines the time (µs) after which an FB (e.g. requiring an external acknowledgement) aborts operation due to a timeout with error message. Output xDone BOOL TRUE : Action successfully completed xBusy BOOL TRUE : Function block active xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error xAborted BOOL TRUE : Action aborted by user
LTrig (FB) ¶ FUNCTION_BLOCK LTrig IMPLEMENTS IFBCommand Serves as a basis for L evel Trig gered function blocks InOut: Scope Name Type Comment Input xEnable BOOL TRUE : Action starts FALSE : Action stops, outputs xDone , xBusy , xError are resetted Output xDone BOOL TRUE : Action successfully completed xBusy BOOL TRUE : Function block active xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error
Helper ¶ DecodeClass (Function) DecodeEvent (Function) EncodeSpec (Function)
DecodeClass (FUN) ¶ FUNCTION DecodeClass : EVENT_CLASS This function serves to extract the vaue eClass of type EVENT_CLASS from parameter dwSpec of the callback function. InOut: Scope Name Type Comment Return DecodeClass EVENT_CLASS The EVENT_CLASS of dwSpec. Input dwSpec DWORD A combination of EVENT and EVENT_CLASS
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