Loading and storing of recipes
The function block fb_ReadWriteFile enables data (up to 16,000 bytes) to be stored permanently in the flash memory of the BX controller. A new program or a project reset does not affect the content of this memory. This function block is not suitable for sustained and continuous use. A maximum of 10000 write cycles are permitted. There is no limit on read operations.
Application: Saving of recipes or settings that only change rarely or not at all, for example controller parameters.
![]() | Note the following during writing of data
|
Function block fb_ReadWriteFile
Function block for reading and writing of recipes

VAR_INPUT
bRead :BOOL;
bWrite :BOOL;
OffsetRead :WORD;
DataReadSize :WORD;
DataRead :Pointer to Byte;
OffsetWrite :WORD;
DataWriteSize :WORD;
DataWrite :Pointer to Byte;
Legend
bRead: A rising edge triggers reading of the function block (bWrite must be FALSE)
bWrite: A rising edge triggers writing of the function block (bRead must be FALSE)
OffsetRead: Offset in the memory 16,000 bytes max.
DataReadSize: Size of data to be read in bytes (16,000 bytes max.)
DataRead: The pointer should be pointed to the data via ADR
OffsetWrite: Offset in the memory 16,000 bytes max.
DataWriteSize: Size of data to be written in bytes (16,000 bytes max.)
DataWrite: The pointer should be pointed to the data via ADR
VAR_OUTPUT
bBusy :BOOL;
bError :BOOL;
bErrorId :UDINT
Legend
bBusy: Indicates that the function block is still active
bError: Function block error
bErrorId: Error number
Return parameter iErrorId |
Meaning |
---|---|
0 |
No error |
1dec |
READ: Data offset and data length more than 16,000 bytes |
2dec |
WRITE: Data offset and data length more than 16,000 bytes |
0x31440708 |
CRC error in the data memory |
0x31470708 |
Writing of data is not yet complete |
Required libraries:
- TcSystemBX.lb6
- TcBaseBX.lb6
Download sample ST program (sample file)