Writes int32
data to a file on the SD card.
If the file with the specified id does not exist, it will be created automatically.
When writing to an uninitialized area, the file will automatically expand.
An SD card is required to use this function.
In the function menu | On the diagram |
---|---|
![]() |
![]() |
Name | Value Type | Description |
---|---|---|
id |
int32 |
File identifier.The file identifier is used when generating the file name on the SD card. For more details, refer to the SD card article |
set |
bool |
Write trigger. The function starts on a rising edge and continues trying until successful, an error occurs, or a False is received on the set input. |
index |
int32 |
Index of the array element from which to begin writing. The first buffer element has an index of 0. |
value0 |
int32 |
Value at input 0 |
... | ... | ... |
valueN-1 |
int32 |
Value at input (N - 1). *N – number of value inputs, defined in the Number of inputs setting. |
Name | Value Type | Description |
---|---|---|
ended |
bool |
Indicator of function completion: 1 – completed 0 – not completed |
status |
int32 |
Function status: 0 – idle 1 – opening 2 – closing 3 – closing (after error) 4 – seeking 6 – extending file 7 – writing -1 – operation not supported -2 – operation not available -3 – file not accessible -4 – invalid element index -5 – error |
0 -> 1 -> 5 -> 2 -> 0 // final status on success
| | |
| | * -> 3 -> [-1 .. -5] // error during execution
| |
| *--> 3 -> [-1 .. -5] // error after opening
|
*--> [-1 .. -5] // error before opening
Name | Description |
---|---|
Number of inputs | Defines the number of value input lines. |
The file with id = 1 is initialized with the int32
array [1, 220, 8383, 44, -505].
When reading the fourth element (index = 3), the outputs will be:
Write the value 1000 to that element:
Verify the write:
Let’s consider an example of writing multiple values.
The file with id = 1 is initialized with the int32
array [11, 22, 33, 44, 55].
When reading from the first element (index = 0), we get:
Now write the array [0, 267, 0], starting from the second element (index = 1):
Verify the result: