FB_HVACPersistentDataFileCopy

This function block can be used, for instance, to copy binary files on the local TwinCAT PC or from a remote TwinCAT PC to the local TwinCAT PC. Network drives cannot be accessed. The following steps are executed upon a rising edge at the input bExecute:
a) Open the source and destination files;
b) Read the source file into a buffer;
c) Write the bytes that have been read from the buffer into the destination file;
d) Check whether the end of the source file has been reached. If not, then repeat b) and c). If yes, then jump to e);
e) Close the source and destination files;
The file is copied one segment at a time. In this function block, the size of the buffer has been specified as 100 bytes, but this can be modified.
VAR_INPUT
srcNETID : T_AmsNetId;
srcFileName : T_MaxString;
destNETID : T_AmsNetId;
destFileName : T_MaxString
bExecute : BOOL;
tAdsTimeOut : TIME;
srcNETID: AmsNetId of the TwinCAT computer on which the function should be executed. If it is to be run on the local computer, an empty string can be entered.
srcFileName: Contains the path and file name for the file to be opened. Note: The path can only point to the local computer’s file system! This means that network paths cannot be used here!
destNETID: AmsNetId of the TwinCAT computer on which the file should be copied.
destFileName: Contains the path and the file name of the destination file. Note: The path can only point to the local computer’s file system! This means that network paths cannot be used here!
bExecute: The steps listed above are executed upon a rising edge at input bExecute.
tAdsTimeOut: States the length of the timeout that may not be exceeded by execution of the ADS command.
VAR_OUTPUT
bDone : BOOL;
bBusy : BOOL;
bError : BOOL;
udiErrorID : UDINT;
bDone: Will be switched to TRUE if the function block is executed.
bBusy: When the function block is activated the output is set, and it remains active until execution of the command has been completed.
bError: This output is switched to TRUE as soon as an error occurs during the execution of a command.
udiErrorID: Contains the command-specific error code (see ADS Return Codes).
Requirements
Development environment | required library | required function |
---|---|---|
TwinCAT 3.1 build 4022.16 or higher | Tc2_HVAC V3.3.1.0 | TF8000 | TC3 HVAC V1.0.0.0 |