I've just installed a Sherline rotary table on a Taig mill and it appears to work fine manually with jogging. Now the next task is to write G code to cut clock teeth. The basic plan is to move the cutter mounted on the spindle in toward the wheel mounted in a chuck mandrell on the vertically mounted rotary table to cut a tooth, move it out to the starting position and then rotate the table. The code includes a subroutine to do this 60 times to cut a wheel with 60 teeth. The problem is that the subroutine doesn't repeat. In addition, the movement back out from the wheel is twice the distance it moves in. I had to add an 1 to the end of the subroutine, Mach wouldn't accept just an M99 or an O1 - it gives a "return called with no sub in effect" and there is a window tha opens with "Please wait, generating path." What am I missing in the following code (disregard the completely commented lines, I just borrowed an existing bit of code). I've also had to reduce the distance the X axis travels - it seems the scale goes out of whack after adding a rotary table.
N5 (File Name = Cut teeth on wheel on Saturday, February 13, 2010)
N10 (Default Mill Post)
N15 (G91.1)
N20 (M5 M9 Stop spindle, Coolant off)
N25 (M6 T1 TOOL Change Sixteenth)
N30 (G43 H1Tool Length offset)
N35 (G0 Z0.0000 Rapid positioning Z axis)
N40 (Rotate Spindle clockwise at 400 M3 S400)
N45 (Positioning of X and Y – rapid because of previous G0)
N50 (G1 Z-0.0100 F10.00 Linear Interpolation of Z axis)
N55 M98 P1 L60 (M98 Calls a subroutine, P is the Routine and Letter O is subroutine label number, L for number of times)
N60 M5 (Program end)
N65 O1 (the subroutine)
N70 G1 X.5 F5 (move X axis for cutter to pass through wheel at feed rate 5)
N75 G1 X-.5 F5 (Move X axis back)
N80 A.016666 (rotate table clockwise 60/360 for 60 teeth in one revolution)
N85 M99 1(Return from subroutine)