Download DMC-1300
Transcript
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. For example; 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]=_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. Automatic Data Capture into Arrays The DMC 1300 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. For controllers with 5 or more axes, 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. DMC1000 Chapter 7 Application Programming 7 • 125