GET_NAMED_MEMORY block
Short summary
Name |
|
→POU type |
|
Category |
|
Conform to →IEC-standard |
not defined in IEC-standard |
Graphical interface |
|
Available since |
|
Functionality
The block returns the →reference to a memory area the name of which you enter at input NAME
.
When the block is called for the first time, the requested memory in the dynamic memory of the target system (heap) is allocated and a reference to it is returned. The memory area referenced by the return value is initialized with 0
during the request. For each subsequent call of the block, a reference to the already allocated memory is returned.
In case of a →cold restart or →warm restart of the application, an allocated memory is automatically released.
As the type information of the return value is saved in addition to the name of the memory area, it is only allowed to use the call of the block on the right side of the assignment operator ":=
" for →assignments to a reference variable. The size of the memory area results from the data type of the reference variable.
Inputs, outputs, return value
|
Identifier |
Description |
|
---|---|---|---|
Inputs: |
|
|
name of the memory area |
Outputs: |
|
|
return code of the allocation:
|
Return value: |
– |
a →reference to the following data types: |
typed reference to the requested memory area or |
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). Moreover, the output RC
returns the appropriate code (see the above table under RC
) and the block itself returns NULL
(as return value).
Example for usage within ST-editor
Exemplary usage of the GET_NAMED_MEMORY block |
---|
|
Neuron recommends to call the GET_NAMED_MEMORY
block once at the most for each memory area to request. On the one hand the time behavior might be unpredictable and on the other hand it might take longer to determine the already allocated memory area. The following example demonstrates the one-time usage:
Recommended usage of the GET_NAMED_MEMORY 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.