'***************************************************************************
'Galil Motion Control Sample DMC Code
'***************************************************************************
'Description:
'Application program to generate 2 PVT points for parabolic velocity profile
'Moves motor back and forth.  
'Set the following variables for Distance, time, cycles, dwell
'***************************************************************************
d= 20000;   'Distance for move (cts)
t= 200;'  time for move (msec)
cycle= 1;    'number of cycles
dwell= 200;   'dwell between moves (msec)
'***************************************************************************
TM 1000;  'sample time
'Initiate variables used in calculations
'PVT needs to be in terms of cts,cts/sec,samples
i= 0;
s_total= t/(_TM/1000);   'total samples for move
s_half= s_total/2;  'half number of samples
'Use V in cts/sec - need 1024 to convert to seconds regardless of TM value
v= ((3*(d/2))/(t/1024)
#a
PVA= d/2,v,s_half
PVA= d/2,0,s_half
PVA= 0,0,0
BT A
JS #wait
WT dwell
PVA= -d/2,-v,s_half
PVA= -d/2,0,s_half
PVA= 0,0,0
BT A
JS #wait
WT dwell
i= i+1
JP #a,i<cycle
EN
#wait;   'subroutine to wait for PVT mode to complete
JP #wait,_PVA<>255
EN