130
●
Chapter 7 Application Programming
DMC-18x2
Variables
For applications that require a parameter that is variable, the DMC-18x2 provides 254 variables.
These variables can be numbers or strings. A program can be written in which certain parameters,
such as position or speed, are defined as variables. The variables can later be assigned by the operator
or determined by program calculations. For example, a cut-to-length application may require that a cut
length be variable.
Example:
PR POSX
Assigns variable POSX to PR command
JG RPMY*70
Assigns variable RPMY multiplied by 70 to JG command.
Programmable Variables
The DMC-18x2 allows the user to create up to 254 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-18x2 instructions. For example, PR is not a good choice for a variable name.
Examples of valid and invalid variable names are:
Valid Variable Names
POSX
POS1
V3OS
Invalid Variable Names
REALLONGNAME
; Cannot have more than 8 characters
123
; Cannot begin variable name with a number
SPEED Z
; 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 (2
31
)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-18x2 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.
Examples:
POSX=_TPX
Assigns returned value from TPX command to variable POSX.
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
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
Содержание DMC-18 2 Series
Страница 3: ...Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 5: ...Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Страница 11: ...Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...