Galil DMC-3425 Automatic Data Capture into Arrays, Using a Variable to Address Array Elements

Models: DMC-3425

1 210
Download 210 pages 53.34 Kb
Page 141
Image 141

DM SPEED[10]

Dimension Speed Array

SPEED[1]=7650.2

Assigns the first element of the array the value 7650.2

SPEED[1]=

Returns array element value

POSX[10]=_TPA

Assigns the 11th element the position of A.

CON[2]=@COS[POS]*2

Assigns the 3rd element of the array the cosine of POS * 2.

TIMER[1]=TIME

Assigns the 2nd element of the array 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.

This 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. This example can also be executed with the automatic data capture feature described below.

Instruction

Interpretation

#A

Begin Program

COUNT=0;DM POS[10]

Initialize counter and define array

#LOOP

Begin loop

WT 10

Wait 10 msec

POS[COUNT]=_TPA

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

Uploading and Downloading Arrays to On Board Memory

Arrays may 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-3425 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 four types of data can be captured and stored in four arrays. The capture rate or time interval may be specified. Recording can be done as a one time event or as a circular continuous recording.

DMC-3425

Chapter 7 Application Programming133

Page 141
Image 141
Galil DMC-3425 user manual Automatic Data Capture into Arrays, Using a Variable to Address Array Elements