SAVE_NAMED_MEMORY_RETAIN block
Short summary
Name |
SAVE_NAMED_MEMORY_RETAIN |
→POU type |
|
Category |
|
Conform to →IEC-standard |
not defined in IEC-standard |
Graphical interface |
|
Available since |
version 3.2.2 (for library Standard) |
Functionality
The block saves a →retentive memory area to persistent storage. The name of the memory area is entered at input NAME.
By default, the appropriate file is saved to the subdirectory PLC of the logi.RTS installation directory. If you prefer that a different directory is used, contact your system integrator and ask to change the configuration of the system service.
Inputs, return value
|
Identifier |
Description |
|
Inputs: |
NAME |
STRING |
name of the memory area |
Return value: |
– |
USINT |
returns result of saving:
|
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 target system is out of memory.
The data type of the variable to which the call has been assigned does not match the data type of the memory area.
The RTSSMem system service has not been loaded.
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
The values of the variables that are declared in the section VAR RETAIN ... END_VAR are loaded in the initial state (= init state) and saved in the term state by using the RTSCycleInfo block.
Best to see the RTSCycleInfo block to find out at which moments the initial cycle and the term cycle respectively are executed.
TYPE
ConfigStruct : STRUCT
MaximumMotorSpeed : REAL := 3.5;
MaximumMotorAcceleration : REAL := 0.75;
Initialized : BOOL;
END_STRUCT;
END_TYPE
PROGRAM ExampleNamedMemoryRetain
VAR
init : BOOL;
term : BOOL;
config : REF_TO ConfigStruct;
END_VAR
RTSCycleInfo(
Init=>init,
Term=>term
);
IF init THEN
config := GET_NAMED_MEMORY_RETAIN(NAME:='Config');
IF config <> NULL AND NOT config^.Initialized THEN
config^.MaximumMotorSpeed := 3.5;
config^.MaximumMotorAcceleration := 0.75;
config^.Initialized := TRUE;
END_IF;
END_IF;
IF term THEN
// The following line only saves the block named 'Config'.
// As an alternative, the PLC program could also call SAVE_ALL_NAMED_MEMORY_RETAIN()
SAVE_NAMED_MEMORY_RETAIN(NAME:='Config');
END_IF;
END_PROGRAM
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.