Galil Motion Control DMC-21 5 Series User Manual page 104

Table of Contents

Advertisement

Programmable Variables
The DMC-21x5 allows the user to create up to 510 variables. Each variable is defined by a name which can be up to
eight characters. The name must start with an alphabetic character; however, numbers are permitted in the rest of
the name. Spaces are not permitted. Variable names should not be the same as DMC-21x5 instructions. For
example, PR is not a good choice for a variable name.
NOTE: It is generally a good idea to use lower-case variable names so there is no confusion between Galil
commands and variable names.
Examples of valid and invalid variable names are:
Valid Variable Names
posa
pos1
speedC
Invalid Variable Names
RealLongName - Cannot have more than 8 characters
123 - Cannot begin variable name with a number
speed C - Cannot have spaces in the name
Assigning Values to Variables:
Assigned values can be numbers, internal variables and keywords, functions, controller parameters and strings.
The range for numeric variable values is 4 bytes of integer (231) followed by two bytes of fraction
(±2,147,483,647.9999).
Numeric values can be assigned to programmable variables using the equal sign.
Any valid DMC-21x5 function can be used to assign a value to a variable. Arithmetic operations are also permitted.
To assign a string value, the string must be in quotations. String variables can contain up to six characters which
must be in quotation.
posA=_TPA;
speed=5.75;
input=@IN[2];
v2=v1+v3*v4;
var="CAT";
MG
var{S3};
Assigning Variable Values to Controller Arguments
Variable values may be used as arguments for controller commands such as
PR
v1;
SP
vS*20000;
Displaying the value of variables at the terminal
Variables may be sent to the screen using the format, variable=. For example, v1= , returns the value of the
variable v1.
Chapter 7 Application Programming ▫ 99
'set posA to current A axis motor position
'set speed to 5.75
'set input to state of Digital Input 2
'set v2 equal to v1 plus v2, then multiplied by v4
'set var to CAT string
'message variable as a string
'set v1 as argument in PR command
'set vS*20000 as argument in SP command
or SP.
PR
DMC-21x5 User Manual 1.0a1

Advertisement

Table of Contents
loading

Table of Contents