AsyncAdd (FUN)ΒΆ
FUNCTION AsyncAdd : RTS_IEC_HANDLE
Function to start a new asynchronous job.
Note
On shutdown or reset, or before download, call AsyncRemoveAll() to remove all registered asynchronous jobs.
During exit of an application (Application reset or delete), an asynchronous job is executed synchronously!
- InOut:
- Scope - Name - Type - Comment - Return - AsyncAdd- RTS_IEC_HANDLE- Handle to the job object - Input - pfJobFunc- POINTER TO BYTE - Function pointer to be called asyncrononous. Use ADR to retrieve the function pointer. - pParam- POINTER TO BYTE - Parameter to be passed to pfJobFunc - pInstance- POINTER TO BYTE - In case of ulIecFunc is ASYNC_IS_IEC, and if pfJobFunc is a method of a FB, pass here the instance pointer of the FB In other cases, set to 0 - pulState- POINTER TO UDINT - Pointer to job state, filled by CmpAsyncMgr. Check this state cyclically. - ulIecFunc- UDINT- Indicates if pfJobFunc is written in IEC or C: ASYNC_IS_IEC or ASYNC_ISNOT_IEC - ulType- UDINT- Type of an async job: ASYNCJOB_TASK, ASYNCJOB_EVENT or ASYNCJOB_HOOK - ulTimeout- UDINT- Timout for the operation in milliseconds. Can be 0, then infinite. - pAsyncJobParam- POINTER TO ASYNCJOB_PARAM - Pointer to structure ASYNCJOB_PARAM. Specify task by name with member TaskParam.pszTaskname. A new task will be created on first call. For other jobs, this same task can be re-used by setting the same name. Specify task priority with member TaskParam.ulTaskPriority. - pResult- POINTER TO RTS_IEC_RESULT - Pointer to the runtime system error code (see CmpErrors2 Interface Library):
- ERR_PARAMETER: invalid parameter 
- Result of CmpMemPool 
- ERR_NOTIMPLEMENTED: ulType ASYNCJOB_EVENT and SysEvent handling fails 
- ERR_NOT_SUPPORTED: ulType ASYNCJOB_TASK and SysTask handling fails 
 
 
