40
•
Chapter 7 Application Programming
CDS-3310
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
posXA[10]=_TPA
Assigns the 10th element the position of A
con[2]=@COS[POS]*2
Assigns the 2
nd
element of the array the cosine of POS * 2.
timer[1]=TIME
Assigns the 1
st
element of the array ‘timer’
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.
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
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
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 seperated 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 CDS-3310 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 be done as a one time event or as a circular continuous recording.
Содержание CDS-3310
Страница 26: ...18 i Chapter 2 Getting Started CDS 3310 THIS PAGE LEFT PLANK INTENTIONALLY...
Страница 32: ...24 i Chapter 3 Connecting I O CDS 3310 THIS PAGE LEFT PLANK INTENTIONALLY...
Страница 124: ...CDS 3310 Chapter 8 Hardware Software Protection i 63 THIS PAGE LEFT PLANK INTENTIONALLY...
Страница 138: ...CDS 3310 Chapter 10 Theory of Operation i 77 THIS PAGE LEFT BLANK INTENTIONALLY...