2user variables, User variables, 2 user variables – Lenze PMSS1000 Simple Servo User Manual
Page 27

Indexer-Programmer-Manual.pdf REV 1.3
The header section of the program contains definitions of the names for user variables and constants
used in the program. If none of these are used in a program the header section is not required.
Events sections contain all scanned events sections. Remember to execute EVENT
statement in main program to enable events. Not all statements are possible to use within event body.
See EVENT/ENDEVENT statement in Language Reference section for details on the statements
restrictions. While GOTO statement is prohibited within event code, you can use JUMP statement to jump
to code in main program body. You can use such technique if you need to change program flow by
occurrence of the event. See JUMP statement in Language Reference section for details.
The main program body of the program contains the main part of the program, which can include all
motion and math statements, labels, I/O commands and subroutine calls. Main body has to be finished
with END statement.
Subroutines are routines hat are called from the body of the program. When a subroutine is called,
program execution is transferred to the subroutine until a RETURN statement occurs. Then, program
execution returns to the body of the program following the GOSUB statement.
Fault handler is the special section of the program embraced with ON FAULT and ENDFAULT
statements. When any fault occurred normal program flow will be interrupted and statements in fault
handler will start to execute. When fault occurs the motion (if any) will be stopped and drive will be
disabled. Events scanning will be stopped until program exits fault handler. Fault handler can be
terminated two ways:
Using RESUME
2.2 User
Variables
SML supports a fixed set of variables that the programmer can use to store data and perform arithmetic.
All user variables are of a single type(see below). Single type variables facility (typeless variables) relieve
programmer of the task to remember and apply conversion rules between types, thus greatly simplifying
programming.
Since SML is 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. When assigning 0 value to
variable it is evaluated as "FALSE" in logic equations and non 0 value evaluates as "TRUE".
In addition to the user variables, system variables are also supported.
System variables are dedicated variables that contain particular values. For example, APOS contains
actual position of the motor shaft. System variables are discussed later in chapter "System Variables and
Flags".
Scope
SML variables are available system wide. Each of the variables can be read and set from any user
program, subroutine or Host Language Command at any time. There is no provision to protect a variable
from change. This is referred as global scope.
27