FB_RemoveDir
This functionblock removes a directory from the data medium. A directory containing data can not be removed!
VAR_INPUT
VAR_INPUT
sNetId : T_AmsNetId;
sPathName : T_MaxString;
ePath : E_OpenPath := PATH_GENERIC; (* Default: generic file path*)
bExecute : BOOL;
tTimeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR
sNetId : Is a string containing the AMS network identifier of the target device to which the ADS command is directed.
sPathName : The directory to be removed. The function block can remove only one directory per call, so only the last component of sPathName can name the directory to be removed.
ePath : The variable of this type selects one of the TwinCAT system paths on the target device to delete a directory.
bExecute : The ADS command is triggered by a rising edge at this input.
tTimeout : States the time before the function is cancelled.
VAR_OUTPUT
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
nErrId : UDINT;
END_VAR
bBusy: This output remains TRUE until the block has executed a command, but at the longest for the duration supplied to the ‘tTimeout’ input. While bBusy = TRUE, no new command will be accepted at the inputs.
bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in ‘nErrId’.
nErrId: Contains the command-specific ADS error code of the most recently executed command.
Function specific ADS error code | Possible reason |
---|---|
0x70C | Folder not found or invalid sPathName or ePath parameter. |
Example in ST: See description of FB_CreateDir.
Requirements
Development Environment | Target System | PLC Libraries to include |
---|---|---|
TwinCAT v2.10.0 Build > 1310 (CE image v2.17d or higher) | PC or CX (x86, ARM) | TcSystem.Lib |