EVTPARAM_CmpIecTask (STRUCT) ¶ TYPE EVTPARAM_CmpIecTask : STRUCT OBSOLETE Event Parameter, please use EVTPARAM_CmpIecTask2 instead InOut: Name Type Comment pTaskDesc POINTER TO Task_Desc Pointer to IEC task description
EVTPARAM_CmpIecTask2 (STRUCT) ¶ TYPE EVTPARAM_CmpIecTask2 : STRUCT Event parameter InOut: Name Type Comment pTaskDesc POINTER TO Task_Desc2 Pointer to IEC task description
EVTPARAM_CmpIecTask_OmittedCycleCounters (STRUCT) ¶ TYPE EVTPARAM_CmpIecTask_OmittedCycleCounters : STRUCT Event parameter InOut: Name Type Comment pTaskDesc POINTER TO Task_Desc Pointer to IEC task description omittedCycleCounters IecTaskOmittedCycleCounters Omitted cycle counters
IEC_CYCLE_STRUCT (STRUCT) ¶ TYPE IEC_CYCLE_STRUCT : STRUCT This struct is passed as parameter to the TaskEntryFunction, see IecTaskCreate InOut: Name Type pTaskInfo POINTER TO Task_Info2 pApplication POINTER TO APPLICATION hTaskHandle RTS_IEC_HANDLE
IecTaskCreate (FUN) ¶ FUNCTION IecTaskCreate : RTS_IEC_HANDLE Create a new IEC Task IEC Tasks itself are used by the scheduler of the runtime. They don’t essentially need a corresponding OS task or timer. They might be handled by the scheduler in a completely different way. The system call for the task entry function has to be enabled. The return value of the task entry function is not evaluated. Note Task_Info2.dwEventFunctionPointer: Function pointer to the event check routine in case Task_Info2.KindOfTask = TaskEvent FUNCTION CheckEvent : BOOL VAR_INPUT END_VAR (* This function checks wether the event is triggered *) (* by returning TRUE: raising edge, status, etc. *) Task_Info2.dwTaskEntryFunctionPointer: Function pointer to the task code FUNCTION IecTaskCyclic : BOOL VAR_INPUT parameter : IEC_CYCLE_STRUCT ; END_VAR VAR udiState : UDINT ; hTask : RTS_IEC_HANDLE ; END_VAR (* ----- mandatory cyclic task frame code begin ----- *) udiState := parameter.pApplication ^. udiState ; hTask := parameter.hTaskHandle ; IF udiState = AS_STOP THEN RETURN ; END_IF IF parameter.pTaskInfo ^. bWatchdog THEN IecTaskEnableWatchdog ( hTask ); END_IF (* ------ mandatory cyclic task frame code end ------ *) Error code: ERR_OK: The new task was successfully created. ERR_FAILED: There was an error in a subsystem (e.g. the scheduler could not allocate his task handle). ERR_PARAMETER: Invalid application- or task info pointer ERR_OUT_OF_LIMITS: Maximum number of Tasks reached (target specific) ERR_NOMEMORY: Unable to allocate the memory, that is necessary for the task description InOut: Scope Name Type Comment Return IecTaskCreate RTS_IEC_HANDLE Handle to newly created task Input pApp POINTER TO APPLICATION Pointer to application that contains the task pTaskInfo POINTER TO Task_Info2 Pointer to task information pResult POINTER TO RTS_IEC_RESULT Pointer to error code
IecTaskCreate2 (FUN) ¶ FUNCTION IecTaskCreate2 : RTS_IEC_HANDLE Create a new IEC Task with taskgroup If the taskgroup does not exist or is no IEC taskgroup, the function returns ERR_PARAMETER. See IecTaskCreate for more details. Error code: ERR_OK: The new task was successfully created. ERR_FAILED: There was an error in a subsystem (e.g. the scheduler could not allocate his task handle). ERR_PARAMETER: Invalid application- or task info pointer, unknown IEC taskgroup ERR_OUT_OF_LIMITS: Maximum number of Tasks reached (target specific) ERR_NOMEMORY: Unable to allocate the memory, that is necessary for the task description InOut: Scope Name Type Comment Return IecTaskCreate2 RTS_IEC_HANDLE Handle to newly created task Input pApp POINTER TO APPLICATION Pointer to application that contains the task pTaskInfo POINTER TO Task_Info2 Pointer to task information psTaskGroup REFERENCE TO STRING Name of existing taskgroup pResult POINTER TO RTS_IEC_RESULT Pointer to error code
IecTaskDelete2 (FUN) ¶ FUNCTION IecTaskDelete2 : RTS_IEC_RESULT Delete an IEC task with timeout This function creates an asynchronous job to delete the IEC task with the given handle and timeout value. When the asynchronous job is successfully created the function returns immediately with ERR_PENDING. There is no indication wether the following deletion of the IEC task itself is successful. Note Due to the asynchronous manner of the deletion a dynamically created IEC task may delete itself. Error code: ERR_PENDING: The asynchronous job to delete the IEC task was successfully created. ERR_FAILED: The asynchronous job to delete the IEC task could not be created. ERR_PARAMETER: Invalid task handle ERR_NOT_SUPPORTED: asynchronous jobs are not supported InOut: Scope Name Type Comment Return IecTaskDelete2 RTS_IEC_RESULT Error code Input hIecTask RTS_IEC_HANDLE Handle to task ulTimeoutMs UDINT Timeout in milliseconds to wait for deleting the task. Some timeouts are predefined: RTS_TIMEOUT_DEFAULT: Use default wait time RTS_TIMEOUT_NO_WAIT: No wait
IecTaskDelete3 (FUN) ¶ FUNCTION IecTaskDelete3 : RTS_IEC_RESULT Delete an IEC task with timeout This function creates an asynchronous job to delete the IEC task with the given handle and timeout value. When the asynchronous job is successfully created the function returns immediately with ERR_PENDING. With asyncState one checks the job completion and finalResult tells wether the deletion of the IEC task itself was successful. Note Due to the asynchronous manner of the deletion a dynamically created IEC task may delete itself. Error code: ERR_PENDING: The asynchronous job to delete the IEC task was successfully created. ERR_FAILED: The asynchronous job to delete the IEC task could not be created. ERR_PARAMETER: Invalid task handle ERR_NOT_SUPPORTED: asynchronous jobs are not supported ERR_NOMEMORY: No memory to manage the asynchronous job InOut: Scope Name Type Comment Return IecTaskDelete3 RTS_IEC_RESULT Error code Input hIecTask RTS_IEC_HANDLE Handle to task ulTimeoutMs UDINT Timeout in milliseconds to wait for deleting the task. Some timeouts are predefined: RTS_TIMEOUT_DEFAULT: Use default wait time RTS_TIMEOUT_NO_WAIT: No wait Inout asyncState UDINT Asnyc state. See CmpAsyncMgr.library::GVL::ASYNCSTATE_XXX for possible states. ASYNCSTATE_READY is set when the job ends. For success check finalResult. finalResult RTS_IEC_RESULT Result of the delete function after completion ERR_OK: task was deleted and the task object is released ERR_TIMEOUT: deletion timed out, task may be still busy ERR_NO_OBJECT: task was not found
IecTaskDisableScheduling (FUN) ¶ FUNCTION IecTaskDisableScheduling : RTS_IEC_RESULT Disable scheduling for the specified task InOut: Scope Name Type Comment Return IecTaskDisableScheduling RTS_IEC_RESULT Returns the runtime system error code (see CmpErrors.library) Input hIecTask RTS_IEC_HANDLE Handle of the task
IecTaskDisableWatchdog (FUN) ¶ FUNCTION IecTaskDisableWatchdog : RTS_IEC_RESULT Disable watchdog for the specified task Note You have to enable the watchdog of the task with IecTaskEnableWatchdog and _not_ with IecTaskEnableWatchdog2 , because they act on different task flags! The watchdog is disabled only for the current cycle! At the next cycle, the watchod is automatically enabled! InOut: Scope Name Type Comment Return IecTaskDisableWatchdog RTS_IEC_RESULT Returns the runtime system error code (see CmpErrors.library) ERR_OK: The watchdog for the task was disabled ERR_PARAMETER: The task handle was invalid Input hIecTask RTS_IEC_HANDLE Handle of the task