Programmable Variables

The DMC-2x00 allows the user to create up to 254 variables. Each variable is defines 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 can be upper or lowercase, or any combination. Variables are case sensitive; SPEEDC ≠ speedC. Variable names should not be the same as DMC-2x00 instructions. For example, PR is not a good choice for a variable name.

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-2x00 function can be used to assign a value to a variable. For example, v1=@ABS[v2] or v2=@IN[1]. 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.

Instruction

Interpretation

posA=_TPA

Assigns returned value from TPA command to variable posA

SPEED=5.75

Assigns value 5.75 to variable SPEED

input=@IN[2]

Assigns logical value of input 2 to variable input

v2=v1+v3*v4

Assigns the value of v1 plus v3 times v4 to the variable v2.

Var="CAT"

Assign the string, CAT, to Var

Assigning Variable Values to Controller Parameters

Variable values may be assigned to controller parameters such as GN or PR.

PR v1

Assign v1 to PR command

SP _VSS*2000

Assign _VSS*2000 to SP command

100 Chapter 7 Application Programming

DMC-2X00

Page 155
Image 155
Galil DMC-2X00 Programmable Variables, Assigning Values to Variables, Assigning Variable Values to Controller Parameters