Variables, Example, Programmable variables – Yaskawa LEGEND-MC User Manual

Page 312: Valid variable names, Invalid variable names

Advertising
background image

302

LEGEND-MC User’s Manual

Variables

Many motion applications include parameters that are variable. For example, a cut-to-length application
often requires that the cut length be variable. The motion process is the same, however the length is
changing.

To accommodate these applications, the LEGEND-MC provides for the use of both numeric and string
variables. 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 the program calculations.

All variables created in the SMC are 48 bit fixed decimal point data. 32 bits are integer (+/- 2147483647)
and 16 bits are fraction (1/65535)

Example:

Programmable Variables

The LEGEND-MC 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. Examples of valid and invalid variable names
are:

Valid Variable Names

POSX

POS1

SPEEDZ

Invalid Variable Names

1POS

123

SPEED Z

It is recommended that variable names not be the same as LEGEND-MC instructions. For example, PR is
not a good choice for a variable name.

The range for numeric variable values is 4 bytes of integer followed by two bytes of fraction (+/-
2,147,483,647.9999).

String variables can contain up to six characters which must be in quotation. Example: VAR="STRING".

Numeric values can be assigned to programmable variables using the equal sign. Assigned values can be
numbers, internal variables and keywords, and functions. String values can be assigned to variables using
quotations.

Any valid LEGEND-MC function can be used to return a value such as V1=@ABS[V2] or V2=@IN[1].
Arithmetic operations are also permitted.

PR POSX

Assigns variable POSX to PR command

JG RPMY*70

Assigns variable RPMY multiplied by 70 to JG command.

Advertising