'***************************************************************************
'Galil Motion Control Sample DMC Code
'***************************************************************************
'Description:
'Uses position tracking mode to rotate motor to specific angles
'over a specified time interval.  Angle positions stored as array elements 
'***************************************************************************
DM angle[1000];    'dimension array of 1000 elements
angle[0]= 1;    'fill array elements in degrees (absolute)
angle[1]= 1.5
angle[2]= 2.2
angle[3]= 2.5
angle[4]= 3.3
#main
t= TIME;    'T is now the reference time
DP 0;       'defines current position to zero
scale= 4000; 'cts per degree
movet= 600;  'move time in seconds (600=10mins)
PT 1;   'Position Tracking mode
i= 0;  'start index of array
count= 1;    'Counts how many 10min intervals have passed
#move
nextt= count*movet*1000+t;   'calculates next time to loop in msec
nextp= angle[i]*scale;       'calculates position to be at in 10mins
speed= (nextp-_TPA)/movet;          'calculates speed to move
SPA= speed
PAA= nextp;                  'moves to next position
#loop
JP #loop,TIME<nextt;         'loops until time reaches 10mins
count= count+1;              'increments counter and array index
i= i+1
JP #move;                    'jumps to repeat process
EN