Arithmetic - Danfoss VLT5000 SyncPos Operating Instructions Manual

Motion controller for danfoss vlt5000 series; danfoss vlt 5000flux series
Table of Contents

Advertisement

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 position in the
DIM statement. Thus the following program 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
E N DWH I LE
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.J8.02 – VLT is a registered Danfoss trade mark
Programmable SyncPos motion controller
■ ■ ■ ■ ■ 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.
N B!
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
93

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents