'TRAVERSE.TXT - This program runs the follower axis of a traverse. 'Quadrature inputs are IO's 15 & 16. The follower axis starts at 'the origin, and travels to a positive direction limit value. 'Dwells for an adjustable number of counts of the master encoder. 'Next, the axis follows in the negative direction to the origin 'where it dwells and reverses direction. This example uses the 'Lynx trainer with 1 turn on the master encoder commanding 1 turn 'of the step motor. The drive was set to 400 SPR, and the encoder ' is a 120 PPR Quadrature encoder. ' 'Last edited 9/19/99 '******** Parameter Setup ******** munit = 400 'Drive set to half step ios 15 = 5,0,1,0,1,1 ios 16 = 6,0,1,0,1,1 var Encct=480 'Encoder 120 quadrature (Lynx uses 4x mult.) var Folratio = Munit/Encct 'Output Counts/Input Counts - 1:1 'following with Lynx trainer var Dwell = 480 'Dwell 480 counts at pos/neg limits. var Dwellpos var Startpos '******** Program ******** pgm 1 lbl traverse pos = 0 'Start at 0 ctr3 = 0 'Clear Master Encoder counter has = Folratio hae = 1 'Enable following (half-axis operation) lbl idle1 br idle1, pos < 2 'Wait until the follower reaches 2 revs hae = 0 'Disable following. Startpos = ctr3 lbl idle2 Dwellpos = Ctr3 - Startpos br idle2, Dwellpos < Dwell 'Wait until master has turned '"Dwell" counts has = -Folratio 'Reverse the following ratio. hae = 1 'Enable following. lbl idle3 br idle3, pos > 0 'Wait until follower returns to 0. hae = 0 'Disable following Startpos = ctr3 lbl idle4 Dwellpos = Ctr3 - Startpos 'Wait until master has turned br idle4, Dwellpos < Dwell '"Dwell" counts has = Folratio 'Reverse the following ratio. hae = 1 'Enable following br idle1 'Return to first loop. end pgm