SaveRetainData block
Short summary
Name |
SaveRetainData |
→POU type |
|
Category |
more system blocks, persistence blocks, block with internal error diagnostic |
Graphical interface |
|
Available since |
The block is supported for the platform WindowsX86 (incl. the built-in PLC under Windows). |
Functionality
The block saves the values of the →retentive variables persistently to a CSV file. Compare SaveRetainDataFast block for an alternative.
Restriction
STRING values are only saved up to the 254th character. Strings > 254 characters are truncated correspondingly.
The values of retentive →function block instances are not saved.
Recommendation on usage
Use the block only once in a →program with a →task for which a corresponding long cycletime has been defined. Moreover, best practice is to trigger the block call by a variable declared in the program (see LoadRetainData block).
Reason: Depending on the number ob variables and the storage device of the target system, the saving of the values might be rather time consuming. Therefore, if you call this block repeatedly in your application, the execution of the application might take longer with each call.
Inputs, outputs, return value
|
Identifier |
Description |
|
Inputs: |
fileName |
STRING |
name of the file where the values of the variables are stored |
Outputs: |
RC |
UDINT |
return code:
|
Return value: |
– |
UDINT |
returns the return code of RC |
Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
See:
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic .
Internal error diagnostic for block
The block checks the following error cases:
The system service has not been loaded.
The return code of the function call equates to an error (output RC ≠ value 0).
In such an error case, the output ENO of the block is set to value FALSE (or an equivalent).
Example for usage within ST-editor
See LoadRetainData block.
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.