
MCO 305 Design Guide
__ Software Reference __
108
MG.33.L4.02 – VLT
®
is a registered Danfoss trademark
DIM
Summary
Definition of an array
Syntax
DIM array [n]
Parameter
array = name of the array
n = number of array elements
Description
Via a DIM instruction at the commencement of the program, it is possible to
declare one or more arrays (= Variable fields).
Arrays are valid for all programs. If arrays are not yet available in the MCO 305
memory, then the arrays are allocated via the DIM instructions. Arrays which are
already available in the memory are checked to see if their size corresponds to the
current DIM commands. If differences are found, then an error registration is
made. If, additionally to the corresponding arrays, new arrays are declared, then
these must also be added at the end of the DIM command.
Each array element can later be accessed, similar to a variable, calculation results,
characters or other information can be stored.
An array element can be called up via the array name and an index. The indices
are admissible from 1 to the defined size in the DIM allocation.
An essential difference between variables and array elements consists in the fact that
arrays are stored in the non-volatile memory, and their contents are permanent even
when the power supply is switched off – insofar as it is saved with SAVEPROM or SAVE
ARRAYS.
In contrast to variables, arrays have a validity not only for one, but for all pro-
grams in the VLT unit flow. The only condition necessary is that the arrays must be
accessible via a DIM command in the desired program which enables a data
exchange between several programs. It is of no importance whether or not the
array is identified with the same name in all the programs. What is important is the
order of the array definitions. This means, for example, that the first defined array
in all programs always refers to the first stored array in the memory, independent
of the array name.
NB!:
The DIM command must be the first instruction in a program, and must appear
before the subroutines. Indices from 1 to the defined size of the array are
permissible.
The array content will not be lost, even following switching off the power supply.
A defined array size is valid for all programs, and cannot be altered. Only the order of
the array definitions (not the names) determines which of the data-fields will be
accessed.
Array definitions can only be canceled via erasure of the entire memory.
Command Group
CON
Syntax Example
DIM xpos[100], ypos[100]
/* define array XPOS and YPOS each with 100 elements */
Program Sample
DIM_01.M
Summary of Contents for MCO 305
Page 4: ......