FB_FileLoad
The contents of a file can be read out with the function block FB_FileLoad. The file is opened implicitly in binary mode, the contents are read out and the file is then closed again.
This function block is only suitable for logging in real-time to a limited extent. |
Inputs
VAR_INPUT
sNetId : T_AmsNetId;
sPathName : T_MaxString;
pReadBuff : PVOID;
cbReadLen : UDINT;
bExecute : BOOL;
tTimeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR
Name | Type | Description |
---|---|---|
sNetId | T_AmsNetId | String containing the AMS network ID of the target device to which the ADS command is addressed (type: T_AmsNetId). |
sPathName | T_MaxString | Storage path and file name of the file to be opened. The path can only point to the local file system of the computer. Network paths cannot be specified here (type: T_MaxString) |
pReadBuff | PVOID | Address of the buffer into which the data are to be read. The buffer can be a single variable, an array or a structure, whose address can be found with the ADR operator. |
cbReadLen | UDINT | Number of bytes to be read. |
bExecute | BOOL | The function block is activated by a rising edge at this input. |
tTimeout | TIME | States the length of the timeout that may not be exceeded by execution of the internal ADS command. |
Outputs
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
nErrId : UDINT;
cbRead : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
bBusy | BOOL | When the function block is activated, this output is set to TRUE and remains set until feedback is received. As long as bBusy is TRUE, no new command can be executed. |
bError | BOOL | If an error occurs during command execution, this output is set, once the bBusy output has been reset. |
nErrId | UDINT | Returns the ADS error code or the command-specific error code when the bError output is set. |
cbRead | UDINT | Number of currently read bytes |
Requirements
Development environment | Target platform | PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT v3.1.4022.0 | PC or CX (x86, x64, ARM) | Tc2_System (System) >= v3.4.22.0 |