However, the sequence of definition must always
be the same since the SyncPos option does not
store the names of the arrays but only their posi-
tion in the DIM statement. Thus the following pro-
gram line is also correct and the xpos array is
identical to the target1 array.
Example
DIM xpos[20], ypos[20], zpos[20], offs[50]
Indexes
The elements of an array are designated by a
corresponding index in square brackets: xpos[5].
Indexes are allowed from 1 to the size of the array
defined. Thus, in the above case for xpos from 1 to
20. If an attempt is made to access elements
before or after this array then an error message is
generated since this could lead to data overrun
and destruction of the array.
Reading and Writing Arrays
Access to the arrays thus defined is made analog
to the use of variables. Thus all of the following
statements are correct:
Example
xpos [1] = 10000
xpos [2] = 20000
xpos [3] = 30000
i = 1
WHILE (i<20) DO
ypos [i] = i*1000
i = i+1
ENDWHILE
zpos [1] = APOS
POSA xpos [1]
offs [1] = (xpos[2]) % 20
Arrays versus Variables
In general arrays can be used everywhere variables
are also permitted. Furthermore, an array only
occupies the location of an internal variable and
thus only reduces the number of maximally permit-
ted variables by one. The maximum number of
variables can be set in the menu "SETTINGS" →
"COMPILER".
MG.10.J4.02 – VLT is a registered Danfoss trade mark
®
VLT
5000 SyncPos option
I I I I I Arithmetic
The compiler offers the following commands and
parameters:
Operators
Bit operators
Comparison Operations greater than, less than,
Logical Operations
Inform yourself about the type of assignment ope-
ration which is structured in accordance with the
Bit/Byte commands and about the priorities of the
operators and the operations.
NB!
All arithmetical operations are integer
number operations.
plus, minus, times, divided
by, XOR, Modulo, Division,
Absolute amount
and, or, invert, left shift,
rightshift, bit, byte, word,
long
greater than or equal to,
less than or equal to, the
same as, not equal
and, or, not
65
Need help?
Do you have a question about the VLT 5000 Series and is the answer not in the manual?