
The Function Block FS_READ reads data from a file.
Warning: When reading very large files, the PLC or the entire system may crash and not restart. Use the input LENGTH=0 with caution.
The file system must have been initialized beforehand using FS_INIT. All operations are performed asynchronously per storage medium created.
A positive edge triggers the reading of data from the storage medium.
Defines the device from which files should be accessed. The device is used per project and can be managed in the context menu under Project External Storage.
Specifies the path to the file on the storage medium. The path corresponds to a Unix file path in UTF-8 format, if supported. The path is represented as follows:
Folder/Subfolder/File.txt
Defines the byte offset from which reading should start. If no offset is defined, reading starts from the beginning of the file.
Defines the maximum length until reading is stopped. If the input is not defined, reading continues to the end of the file.
Note: The maximum readable size when LENGTH=0 is 1,024,000 bytes for safety reasons.
The output returns a pulse upon success to perform the next operation. The pulse occurs when the process ends, even if an error has occurred.
Returns the read data. The state is stored for later use.
The input is true if the end of the file has been reached.
The output is true if the UTF-8 Byte Order Mark was found. The BOM is determined with every read operation.
In case of an error, returns a text with an error message. This is FALSE if no error has occurred. The state is stored for later use.
Possible causes: