Examples:
DM speed[10]
Dimension speed Array
speed[0]=7650.2
Assigns the first element of the array, 'speed' the value 7650.2
speed[0]=
Returns array element value
posx[10]=_TPX
Assigns the 10
th
element of the array 'posx' the returned value from the tell position
command.
con[1]=@COS[pos]*2
Assigns the second element of the array 'con' the cosine of the variable POS multiplied by 2.
timer[0]=TIME
Assigns the first element of the array timer the returned value of the TIME keyword.
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.
Example:
#A
Begin Program
count=0;DM pos[10]
Initialize counter and define array
#LOOP
Begin loop
WT 10
Wait 10 msec
pos[count]=_TPX
Record position into array element
pos[count]=
Report position
count=count+1
Increment counter
JP #LOOP,count<10
Loop until 10 elements have been stored
EN
End Program
The above example records 10 position values at a rate of one value per 10 msec. The values are stored in an array
named 'pos'. The variable, 'count', is used to increment the array element counter. The above example can also be
executed with the automatic data capture feature described below.
Uploading and Downloading Arrays to On Board Memory
The GalilTools software is recommended for downloading and uploading array data from the controller. The
GalilTools Communication library also provides function calls for downloading and uploading array data from the
controller to/from a buffer or a file.
Arrays may also be uploaded and downloaded using the QU and QD commands.
QU array[],start,end,delim
QD array[],start,end
where array is an array name such as A[].
start is the first element of array (default=0)
end is the last element of array (default=last element)
delim specifies whether the array data is separated by a comma (delim=1) or a carriage return
(delim=0).
The file is terminated using <control>Z, <control>Q, <control>D or \.
Automatic Data Capture into Arrays
The DMC-42x0 provides a special feature for automatic capture of data such as position, position error, inputs or
torque. This is useful for teaching motion trajectories or observing system performance. Up to eight types of data
can be captured and stored in eight arrays. The capture rate or time interval may be specified. Recording can done
as a one time event or as a circular continuous recording.
Chapter 7 Application Programming ▫ 127
DMC-42x0 User Manual
Summary of Contents for DMC-42 0 Series
Page 195: ...ICM 2900 PCB Layout Appendices 191 DMC 42x0 User Manual...
Page 205: ...CB 50 100 Drawings Appendices 201 DMC 42x0 User Manual...
Page 206: ...Appendices 202 DMC 42x0 User Manual...
Page 207: ...Appendices 203 DMC 42x0 User Manual...
Page 208: ...Appendices 204 DMC 42x0 User Manual...
Page 209: ...Appendices 205 DMC 42x0 User Manual...
Page 210: ...Appendices 206 DMC 42x0 User Manual...
Page 211: ...Appendices 207 DMC 42x0 User Manual...
Page 214: ...CB 50 80 Drawing Appendices 210 DMC 42x0 User Manual...