Programming – Lenze PM94P01C User Manual

Page 37

Advertising
background image

PM94P01C

35

Programming

There are two types of variables in the PositionServo drive -

User Variables and System Variables.

User Variables are a fixed set of variables that the programmer can use to store data and perform arithmetic
manipulations. All variables are of a single type. Single type variables, i.e. typeless variables, relieve the programmer of
the task of remembering to apply conversion rules between types, thus greatly simplifying programming.

User Variables

V0-V31

User defined variables. Variables can hold any numeric value including logic (Boolean 0 - FALSE and
non 0 - TRUE) values. They can be used in any valid arithmetic or logical expressions.

NV0-NV31 User defined network variables. Variables can hold any numeric value including logic (Boolean 0

- FALSE and non 0 - TRUE) values. They can be used in any valid arithmetic or logical expressions.
Variables can be shared across Ethernet network with use of statements SEND and SENDTO.

Since SML is a typeless language, there is no special type for Boolean type variables (variables that can be only 0 or
1). Regular variables are used to facilitate Boolean variables. Assigning a variable a “FALSE” state is done by setting it
equal to “0”. Assigning a variable a “TRUE” state is done by assigning it any value other than “0”.

Scope

SML variables are accessible from several sources. Each of the variables can be read and set from any user program
or Host communications interface at any time. There is no provision to protect a variable from change. This is referred
to as global scope.

Volatility

User variables are volatile i.e. they don’t maintain their values after the drive is powered down. After power up the values
of the user variables are set to 0. Loading or resetting the program doesn’t change variables values.

In addition to the user variables, system variables are also provided. System variables are dedicated variables that
contain specific information relative to the setup and operation of the drive. For example,

APOS variable holds actual

position of the motor shaft. For more details refer to Section 2.9.

Flags, Resolution and Accuracy

Any variable can be used as a flag in a logical expression and as a condition in a conditional expression. Flags are often
used to indicate that some event has occurred, logic state of an input has changed or that the program has executed to
a particular point. Variables with non ‘0’ values are evaluated as “TRUE” and variables with a “0” values are evaluated
as “FALSE”.

Variables are stored internally as 4 bytes (double word) for integer portion and 4 bytes (double word) for fractional
portion. Every variable in the system is stored as 64 bit in 32.32 fixed point format. Maximum number can be represented
by this format is +/- 2,147,483,648. Variable resolution in this format is 2.3E-10.

Advertising