Elements Of The Programming Language - Danfoss VLT 5000 Series Manual

Synchronizing and positioning option onizing and positioning option
Hide thumbs Also See for VLT 5000 Series:
Table of Contents

Advertisement

I I I I I Elements of the Programming Language
Constants
Constants can be used anywhere where parame-
ters or values are expected. Constants are usually
entered in integral numbers, for example:
value = 5000
Constants ...
...
are integer number values between -2 to +2
billion,
...
are valid within the entire program (they are
global),
...
can be entered as a decimal, hexadecimal
(0x + hexadecimal number), octal (0 + octal
number) or in ASCII (between apostrophes), for
example:
value = 5000
value = 0x7F
value = 0100
value = 'A'
Hexadecimal and ASCII entries, in particular,
avoid many conversions and make the pro-
gram more readable, for example:
key = 'A'
The advantage of constants is, that they don't
need own storage capacity.
Variables ...
...
can only be used for intermediate data
storage of inquiry and calculation results.
...
occur via the allocation of a value.
...
must not be defined separately.
...
are valid within the whole program, (i.e. they
are global)
...
contain integer number values between –2 to
+2 billion.
...
can be used within commands, instead of
constant values.
...
must be allocated a value before use in a
command.
Variable Identification Names
...
can be of any length
...
can consist of letters, numerals and underlines
...
must not contain any country-specifics, such
as "ä", "é"
...
must begin with a letter
...
can be written in small or capital letters (no
difference!)
...
may not be identical to a command name
64
= decimal 5000
= decimal 127
= decimal 64
= decimal 65
VLT
®
5000 SyncPos option
Special Variables
ERRNO = A system variable, which contains the
relevant error number
Arrays
Writing programs with dialog requires user input or
positions to be stored for a longer period of time,
for example, even after the VLT has been turned
off. Usually such input consists of several values
which are best stored in fields or arrays.
Arrays are stored in the memory area of the user
program and are defined globally, that means they
are independent of the current program. The user
can determine how many arrays are defined and
how large the individual arrays should be. This
determination is made with the DIM statement and
is then fixed and cannot be changed (except by
erasing memory). Each program that is intended to
use arrays must contain a corresponding DIM
statement which corresponds to the original defini-
tion. Otherwise an error will be indicated.
DIM Statement
The DIM statement has to be the first statement in
the program and must appear before the
subroutine area.
The DIM statement specifies the arrays to be sub-
sequently used. If no arrays have been previously
created then they will be created now. If arrays had
been previously defined then it is important that
the information corresponds with the original
definition.
Example
DIM target1[20], target2[20], target3[20], plant_offset[50]
DIM parameter[10]
With these commands a total of 5 arrays have
been defined with their corresponding sizes. If this
program is executed once then the arrays listed
above will be created in the SyncPos option. If,
when the program is re-started, it is determined
that the definition of the arrays differs from the
arrays in the SyncPos option, then this is indicated
as an error. However, it is correct if a second pro-
gram only contains the following line:
Example
DIM target1[20], target2[20], target3[20]
MG.10.J4.02 – VLT is a registered Danfoss trade mark

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents