'**************************************
'Galil Sample Code
'Creating multiple timers using a 
'"timer thread"
'
'Timers can be reset at any time by
'sending timer[x]=0 where x is the 
'timer to reset
'
'Note max value for array element is 
'2^31
'**************************************

#AUTO
numtimer= 20;'Number of timers
tmrtick= 1000;'ms between timer ticks
XQ #timer,1;'start timer thread
EN

#timer
DM timer[numtimer];'create timer array
i= 0;'counter
AT 0;'set the first time reference
#tick
timer[i]= timer[i]+1;'Increment timer
i= i+1
JP #tick,i<numtimer;'Cycle each timer
i= 0
AT (-1*tmrtick);'Wait for spec'd time
JP #tick