Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: ChrisAttebery on January 29, 2014, 04:36:55 PM

Title: How to repeat a subroutine infinitely?
Post by: ChrisAttebery on January 29, 2014, 04:36:55 PM
Hello,

I have a few jobs where I need to load a tool and then run a few short operations on multiple parts in my vice. I'd like to set up my code so that I load the tool in Mach3 once and then repeat the machining ops multiple times.

Would the following work? Would I just hit Stop after the last part?

-----------------------------
(program start)
M6 T1 (tool change)
G43 H1 (apply TLO)

M98 P1 L9999 (call subroutine)

M30 (end program)

O1
M0 (load part and hit cycle start)
(do some operations)
M99

----------------------------


Thanks,


Chris
Title: Re: How to repeat a subroutine infinitely?
Post by: Graham Waterworth on February 04, 2014, 05:41:00 AM
If you are going to press cycle start each time just re-run the main program calling the sub(s) as many times as is needed to complete the operation.