SysDirOpen30 (FUN) ¶ FUNCTION SysDirOpen30 : UDINT InOut: Scope Name Type Return SysDirOpen30 UDINT Input szDir REFERENCE TO STRING szDirEntry REFERENCE TO STRING diMaxDirEntry DINT pDirInfo POINTER TO DirInfo30 pResult POINTER TO UDINT
SysDirRead30 (FUN) ¶ FUNCTION SysDirRead30 : UDINT InOut: Scope Name Type Return SysDirRead30 UDINT Input hDir UDINT szDirEntry REFERENCE TO STRING diMaxDirEntry DINT pDirInfo POINTER TO DirInfo30
SysDirRemove30 (FUN) ¶ FUNCTION SysDirRemove30 : UDINT InOut: Scope Name Type Return SysDirRemove30 UDINT Input szDir REFERENCE TO STRING
SysDirRename30 (FUN) ¶ FUNCTION SysDirRename30 : UDINT InOut: Scope Name Type Return SysDirRename30 UDINT Input szOldDirName REFERENCE TO STRING szNewDirName REFERENCE TO STRING
File and Project Information ¶ Scope Name Type Content FileHeader creationDateTime date 03.07.2018, 10:34:34 companyName string 3S-Smart Software Solutions GmbH libraryFile SysDir23.library primaryProject True productName CODESYS productProfile CODESYS V3.5 SP13 contentFile SysDir23.clean.json version version 2.0.0.0 ProjectInformation Released bool True Support32BitOnly True LastModificationDateTime date 03.07.2018, 10:34:34 LibraryCategories library-category-list System|SysLibs23 Author string 3S - Smart Software Solutions GmbH Company System Description See: Description Project SysDir23 Title SysDir23 Version version 3.5.13.0
SysDirAsync Library Documentation ¶ Company System Title SysDirAsync Version 3.5.19.0 Categories System|SysLibs Author 3S - Smart Software Solutions GmbH Placeholder SysDirAsnc Description 1 ¶ All asynchronous system libraries are only asynchronous wrappers around their underlaying System-Library. So this library is only an asynchronous wrapper around the SysDir.library. The asynchronous functions are named as the correspnding function in the base library, but only with the ending <SysFunction>Async. Every asynchronous system function is included in one function block, with the ending <SysLib>AsyncFB. This FB must be instantiated to use all asynchonous methods. Each asynchronous method has 3 parameters: t<SysFunction>: Pointer to the parameter structure (see below) pudState: Pointer on current status of the asynchonous action: ASYNCSTATE_INVALID : UDINT := 16#FFFFFFFF ; ASYNCSTATE_PENDING : UDINT := 0 ; ASYNCSTATE_ACTIVE : UDINT := 1 ; ASYNCSTATE_READY : UDINT := 2 ; ASYNCSTATE_ERROR : UDINT := 3 ; ASYNCSTATE_TIMEOUT : UDINT := 4 ; The status at starting the asynchronous job always is ASYNCSTATE_INVALID. pResult: Pointer to runtime system error code (see CmpErrors.library) Each asynchonous method gets the same parameter as the base system library, but they are collected to one parameter structure. The name of this parameter structure has always the prefix “t”: t<SysFunction> For a description of the particular function parameters please see the chapters on the corresponding functions in the documentation on the System-Base library (<SysLib>.library). When calling the asynchronous method, the asynchronous job gets started. The job will be finished as soon as the status has got one of the following three values: ASYNCSTATE_READY: Job successfully finished ASYNCSTATE_ERROR: Job terminated with error ASYNCSTATE_TIMEOUT: Job timeout reached before job could be finished successfully The last parameter in the parameter structure contains always the result of the base system function indicating whether the asynchronous job could be finished successfully of not. The result value of each asynchronous method is the handle of the asynchronous job. By use of this handle and the functions of the library CmpAsyncMgr.library further information on the asynchronous job can be retrieved. USAGE of the FB: ¶ Before first use of the function block, you have to call AsyncSetJobParams() to initialize the asynchronous manager. After this, you can use any of the asynchronous methods! DECLARATION : step : INT := 1 ; dir : SysDirAsync.SysDirAsyncFB ; jobparams : SysDirAsync.AsyncJob_Param ; taskName : STRING := 'SysDirAsyncTask' ; // an emtpy string works too but is not self-explanatory open : SysDirAsync.tSysDirOpen ; read : SysDirAsync.tSysDirRead ; close : SysDirAsync.tSysDirClose ; hDir : SysDirAsync.RTS_IEC_HANDLE ; dirName : STRING := '' ; // an emtpy string represents the working directory stateJob : UDINT ; ASM_Result : SysDirAsync.RTS_IEC_RESULT ; RTS_Result : SysDirAsync.RTS_IEC_RESULT ; dirInfo : SysDirAsync.dirInfo ; iError : INT ; iErrorcode : INT ; // xy means error y in step x xDone : BOOL ; xError : BOOL ; IMPLEMENTATION : CASE step OF 1 : // prepare the FB jobparams.TaskParam.pszTaskname := ADR ( taskName ); // Name of the task. A new task will be created // on first call. If the same name is used // again for other job, task will be re-used jobparams.TaskParam.ulTaskSleepTime := 10 ; jobparams.TaskParam.phTaskHandle := TO_UDINT ( -1 ); jobparams.TaskParam.ulEndTaskAfterJob := 0 ; dir.AsyncSetJobParams ( SysDirAsync.ASYNCJOB_TASK , 1000000 , ADR ( jobparams )); step := step + 1 ; 2 : // start open a directory asynchronously open.szDir := dirName ; open.diMaxDirEntry := 80 ; open.pDirInfo := ADR ( dirInfo ); open.pulOut := ADR ( hDir ); open.pResult := ADR ( RTS_Result ); dir.SysDirOpenAsync ( ADR ( open ), ADR ( stateJob ), ADR ( ASM_Result )); step := step + 1 ; 3 : // check cyclic if the job is done IF stateJob = SysDirAsync.ASYNCSTATE_READY THEN // the job is done step := step + 1 ; ELSIF stateJob = SysDirAsync.ASYNCSTATE_ERROR THEN // the job failed, check ASM_Result iError := 1 ; ELSIF stateJob = SysDirAsync.ASYNCSTATE_TIMEOUT THEN // the job timed out iError := 2 ; END_IF 4 : // check the RTS results IF hDir <> SysDirAsync.RTS_INVALID_HANDLE AND RTS_Result = SysDirAsync.Errors.ERR_OK THEN // the dir was successfully opened step := step + 1 ; ELSE IF RTS_Result = SysDirAsync.Errors.ERR_PARAMETER THEN // The dir is not there iError := 1 ; ELSIF RTS_Result = SysDirAsync.Errors.ERR_END_OF_OBJECT THEN // The dir is empty iError := 2 ; ELSE iError := 3 ; END_IF END_IF 5 : // read next dir entry read.diMaxDirEntry := 80 ; read.pDirInfo := ADR ( dirInfo ); read.pulOut := ADR ( RTS_Result ); dir.SysDirReadAsync ( ADR ( read ), ADR ( stateJob ), ADR ( ASM_Result )); step := step + 1 ; 6 : // check cyclic if the job is done IF stateJob = SysDirAsync.ASYNCSTATE_READY THEN // the job is done step := step + 1 ; ELSIF stateJob = SysDirAsync.ASYNCSTATE_ERROR THEN // the job failed, check ASM_Result iError := 1 ; ELSIF stateJob = SysDirAsync.ASYNCSTATE_TIMEOUT THEN // the job timed out iError := 2 ; END_IF 7 : // check the RTS results IF RTS_Result = SysDirAsync.Errors.ERR_OK THEN // the dir entry was successfully read, read next step := 5 ; ELSIF RTS_Result = SysDirAsync.Errors.ERR_END_OF_OBJECT THEN // There are no more dir entries to read step := step + 1 ; ELSE // An error occured, close the directory any way step := step + 1 ; END_IF 8 : // close the dir asynchronously close.pulOut := ADR ( hDir ); dir.SysDirCloseAsync ( ADR ( close ), ADR ( stateJob ), ADR ( ASM_Result )); step := step + 1 ; 9 : // check cyclic if the job is done IF stateJob = SysDirAsync.ASYNCSTATE_READY THEN // the job is done step := step + 1 ; ELSIF stateJob = SysDirAsync.ASYNCSTATE_ERROR THEN // the job failed, check ASM_Result iError := 1 ; ELSIF stateJob = SysDirAsync.ASYNCSTATE_TIMEOUT THEN // the job timed out iError := 2 ; END_IF 10 : // finished without error xDone := TRUE ; 99 : // an error occured, check iErrorcode xError := TRUE ; END_CASE IF iError <> 0 AND NOT xError THEN iErrorcode := step * 10 + iError ; step := 99 ; END_IF Contents: ¶ DUT tSysDirClose (Struct) tSysDirCreate (Struct) tSysDirDelete (Struct) tSysDirGetCurrent (Struct) tSysDirOpen (Struct) tSysDirRead (Struct) tSysDirRename (Struct) tSysDirSetCurrent (Struct) SysDirAsyncFB (FunctionBlock) SysDirCloseAsync (Method) SysDirCreateAsync (Method) SysDirDeleteAsync (Method) SysDirGetCurrentAsync (Method) SysDirOpenAsync (Method) SysDirReadAsync (Method) SysDirRenameAsync (Method) SysDirSetCurrentAsync (Method) Wrapper Indices and tables ¶ 1 Based on SysDirAsync.library, last modified 02.03.2023, 11:04:39. LibDoc 4.4.0.0-b.27 The content file SysDirAsync.clean.json was generated with CODESYS V3.5 SP16 Patch 3 on 02.03.2023, 11:04:41.
DUT ¶ tSysDirClose (Struct) tSysDirCreate (Struct) tSysDirDelete (Struct) tSysDirGetCurrent (Struct) tSysDirOpen (Struct) tSysDirRead (Struct) tSysDirRename (Struct) tSysDirSetCurrent (Struct)
tSysDirClose (STRUCT) ¶ TYPE tSysDirClose : STRUCT InOut: Name Type Comment pulOut POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)
SysCpuSetBit2 (FUN) ¶ FUNCTION SysCpuSetBit2 : RTS_IEC_RESULT <description> Set a bit in an BYTE variable in one processor step. This operation is to provide a multitasking save operation. </description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library).</p></result> InOut: Scope Name Type Comment Return SysCpuSetBit2 RTS_IEC_RESULT Input pbyValue POINTER TO BYTE <param name=”pbyValue” type=”IN”>Pointer to the unsigned value to set a bit inside in one atomic processor step</param> ulBit UDINT <param name=”ulBit” type=”IN”>Bit number inside the variable to set. 0=first bit, 7=last bit</param>
SysCpuTestAndReset (FUN) ¶ FUNCTION SysCpuTestAndReset : RTS_IEC_RESULT <description> Test and reset a bit in an ULONG variable in one processor step. This operation is to provide a multitasking save operation. </description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library). ERR_OK: If bit could be reset and was set before, ERR_FAILED: If bit is still reset </p></result> InOut: Scope Name Type Comment Return SysCpuTestAndReset RTS_IEC_RESULT Input pulValue POINTER TO UDINT <param name=”pulValue” type=”IN”>Pointer to the unsigned value to test and reset a bit inside in one atomic processor step</param> ulBit UDINT <param name=”ulBit” type=”IN”>Bit number inside the variable to test and reset. 0=first bit, 31=last bit</param>