Example, Qu array[ ],start,end,comma, Qd array[ ],start,end – Yaskawa LEGEND-MC User Manual

Page 317: Where array is an array name such as a, Start is the first element of array (default=0), Automatic data capture into arrays, Commands used

Advertising
background image

307

LEGEND-MC User’s Manual

An array element number can also be a variable. This allows array entries to be assigned sequentially
using a counter.

Example:

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 as follows.

Arrays may be uploaded and downloaded using the QU and QD commands.

QU array[ ],start,end,comma

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)

Comma -- if comma is a 1, then the array elements are separated by a comma. If not a 1, then the
elements are separated by a carriage return.

The file is terminated using <control>Z, <control>Q, <control>D or \.

Automatic Data Capture into Arrays

The LEGEND-MC 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.

Commands used:

#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

RA n[ ],m[ ],o[ ],p[ ]

Selects up to four arrays for data capture. The arrays must be

defined with the DM command.

RD_TI,_TPX,_SCZ,_TSY

Selects the type of data to be recorded. See the table below for
the various types of data. The order of data type is important
and corresponds with the order of n,m,o,p arrays in the RA
command. In this example, the _TI input data is stored in the
first array selected by the RA command.

Advertising