Arrays, Defining arrays, Example – Yaskawa LEGEND-MC User Manual
Page 316: Assignment of array entries, Defining arrays assignment of array entries
306
LEGEND-MC User’s Manual
Arrays
For storing and collecting numerical data, the LEGEND-MC provides array space for 8000 elements in up
to 14 arrays. Arrays can be used to capture real-time data, such as position, torque and analog input values.
In the contouring mode, arrays are convenient for learning a position trajectory and later playing it back.
Defining Arrays
An array is defined by a name and number of entries using the DM command. The name can contain up to
eight characters, starting with an uppercase alphabetic character.
The number of entries in the defined array is enclosed in [ ].
Up to 14 different arrays may be defined. The arrays are one dimensional.
All array elements have the same structure as variables, 48 bit decimal point.
Example:
Each array element has a numeric range of 4 bytes of integer (2
31
)followed by two bytes of fraction (+/-
2,147,483,647.9999).
Array space may be de-allocated using the DA command followed by the array name. DA*[0] de-
allocates all the arrays.
Assignment of Array Entries
Like variables, each array element can be assigned a value. Assigned values can be numbers or returned
values from instructions, functions and keywords.
Values are assigned to array entries using the equal sign. Assignments are made one element at a time by
specifying the element number with the associated array name.
NOTE: Remember to define arrays using the DM command before assigning entry values.
Example:
DM POSX[7]
Defines an array named POSX with seven entries
DM SPEED[100]
Defines an array named speed with 100 entries
DM POSX[0]
Frees array space
DM SPEED[10]
Dimension Speed Array
SPEED[1]=7650.2
Assigns the first element of the array, SPEED the value
7650.2
SPEED[1]=
Returns array element value
POSX[10]=_TPX
Assigns the 10th element of the array POSX the returned
value from the tell position command.
CON[2]=@COS[POS]*2
Assigns the second element of the array CON the cosine of
the variable POS multiplied by 2.
TIMER[1]=TIME
Assigns the first element of the array timer the returned
value of the TIME keyword.