Dynamic memory allocation functions
The following functions enable the dynamic allocation of arrays for storing DINT integer values:
ARCREATE allocates an array of DINT integers.
ARREAD read a DINT integer in an array allocated by ARCREATE.
ARWRITE write a DINT integer in an array allocated by ARCREATE.
|
|
ARCREATE: array allocation
OK := ARCREATE (ID, SIZE);
ID : DINT integer ID to be assigned to the array (first possible ID is 0) .
SIZE : DINT wished number of DINT values to be stored in the array.
OK : DINT return check.
Return values
- OK - array is allocated and ready for read / write operations.
- The specified ID is invalid or already used for another array.
- The specified size is invalid.
- Not enough memory (action denied by the Operating System).
The memory allocated by ARCREATE will be released when the application stops.
ARREAD: read array element
VAL := ARREAD (ID, POS);
ID : DINT integer ID of the array.
POS : DINT index of the element in the array (first valid index is 0).
VAL : DINT value of the specified item or 0 if arguments are invalid.
ARWRITE: write array element
OK := ARWRITE (ID, POS, IN);
ID : DINT integer ID of the array.
POS : DINT index of the element in the array (first valid index is 0).
IN : DINT value to be assigned to the element.
OK : DINT return check.
Return values
- OK - element was forced successfully
- The specified ID is invalid (not an allocated array).
- The specified index is invalid (out of array bounds).
Dynamic memory allocation functions |
IEC 61131-3 Automation platform > Programming - Reference guide > Advanced operations > Dynamic memory allocation functions |
Created with the Personal Edition of HelpNDoc: Maximize Your Documentation Efficiency with a Help Authoring Tool