Arrays; Defining Arrays; Assignment Of Array Entries - Galil Motion Control DMC-18 2 Series User Manual

Table of Contents

Advertisement

Examples of Keywords:
V1=_LFX
V3=TIME
V4=_HMW

Arrays

For storing and collecting numerical data, the DMC-18x2 provides array space for 8000 elements.
The arrays are one dimensional and up to 30 different arrays may be defined. Each array element has a
numeric range of 4 bytes of integer (2
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 holding the points of a position trajectory in a record and
playback application.

Defining Arrays

An array is defined with the command DM. The user must specify a name and the number of entries
to be held in the array. An array name can contain up to eight characters, starting with an uppercase
alphabetic character. The number of entries in the defined array is enclosed in [ ].
Example:
DM POSX[7]
DM SPEED[100]
DM POSX[0]

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.
Array elements are addressed starting at count 0. For example the first element in the POSX array
(defined with the DM command, DM POSX[7]) would be specified as POSX[0].
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: Arrays must be defined using the command, DM, before assigning entry values.
Examples:
DM SPEED[10]
SPEED[1]=7650.2
SPEED[1]=
POSX[10]=_TPX
CON[2]=@COS[POS]*2
TIMER[1]=TIME
Using a Variable to Address Array Elements
An array element number can also be a variable. This allows array entries to be assigned sequentially
using a counter.
132 ● Chapter 7 Application Programming
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
Assign V1 the logical state of the Forward Limit Switch on the X-axis
Assign V3 the current value of the time clock
Assign V4 the logical state of the Home input on the W-axis
31
)followed by two bytes of fraction (+/-2,147,483,647.9999).
Defines an array names POSX with seven entries
Defines an array named speed with 100 entries
Frees array space
Dimension Speed Array
Assigns the second element of the array, SPEED the value 7650.2
Returns array element value
Assigns the 11th element of the array POSX the returned value from the tell
position command.
Assigns the third element of the array CON the cosine of the variable POS
multiplied by 2.
Assigns the second element of the array timer the returned value of the TIME
keyword.
DMC-18x2

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dmc-1812Dmc-1822Dmc-1832Dmc-1842

Table of Contents