Function Description
The RD_FILE_TO_DATA function allows data to be read
from a file, at the current position of the file, and enables it to
be copied into a direct address variable (%MW1000), a located variable (VAR0 @ %MW1000), or an unlocated
variable. After reading, the current position in the file is updated.
This elementary function reads a number of bytes that correspond to the size of the variable in the specified file.
The additional
parameters EN and ENO can be configured.
FBD Representation
The representation in FBD of the RD_FILE_TO_DATA function is as follows:

Ladder Representation
The representation in Ladder of the RD_FILE_TO_DATA function is as follows:

IL representation
Representation:
CAL RD_FILE_TO_Instance (REQ:=ReadFileToDataStart, FILEDESC:=ReadFileToDataDescriptor, DONE=>ReadFileToDataDone, ERROR=>ReadFileToDataError, STATUS=>ReadFileToDataStatus, VARIABLE=>ReadFileToDataVariable, NBBYTESRD=>ReadFileToDataNumberBytesReadStatus)
ST representation
Representation:
RD_FILE_TO_Instance (REQ:=ReadFileToDataStart, FILEDESC:=ReadFileToDataDescriptor, DONE=>ReadFileToDataDone, ERROR=>ReadFileToDataError, STATUS=>ReadFileToDataStatus, VARIABLE=>ReadFileToDataVariable, NBBYTESRD=>ReadFileToDataNumberBytesReadStatus);
Parameter Description
The following table describes the input parameters:
Parameter |
Type |
Comment |
|---|---|---|
|
|
This parameter specifies the file
descriptor returned by the |
The following table describes the output parameters:
Parameter |
Type |
Comment |
|---|---|---|
|
|
This parameter specifies the variable or table which will receive the data. Any direct address variable
( To copy to a table or direct variables, the
syntax used is |
|
|
This parameter specifies the size effectively read. It may be smaller than the size of the variable.The main reason why the NBBYTESRD can be smaller than the Variable size is that:
Then the read variable is only updated with the number of bytes read and the other bytes of data come from the last reading. |
Description of common parameters.

