109
MG.10.J8.02 – VLT is a registered Danfoss trade mark
Programmable SyncPos motion controller
Software Reference
■
■
■
■
■
DI M
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 SyncPos option 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
momentary DIM commands. If differences are
found, then an error registration is made. If, addi-
tionally 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 con-
tents 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 programs in the VLT 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.
Summary
Definition of an array
Syntax
DIM array [n]
Parameter
array = name of the array
n
= number of array elements
NB!
The DIM command must be the first instruc-
tion in a program, and must appear before the
subroutines.
Indices from 1 to the defined size of the array are
permissible.
A defined array size is valid for all programs, and
cannot be altered. Only the order of the array defi-
nitions (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