Hello Guest it is October 16, 2019, 06:37:47 AM

Author Topic: Sub Programs  (Read 2832 times)

0 Members and 1 Guest are viewing this topic.

Sub Programs
« on: February 21, 2009, 04:59:47 PM »
Hi,

   I have several 5/8 diameter shafts that have to have slots milled across them. I would like to do the slots with a sub program. I have never done a sub program and I am not really proficient in G & M code. Can someone explain where to place the sub program so that it can be called with M98. What I want to do is move to the location for the slot, call the sub program, mill the slot, end the sub program, go to the next slot and repeat until all the slots are done.

Thanks,

        ErnieD

BClemens

*
Re: Sub Programs
« Reply #1 on: February 21, 2009, 06:56:46 PM »
Is an M98 a necessity? You could write a very simple G code program to do this and include it in a main one with a tool change; or just M1.

Bill C.

Offline Chip

*
  • *
  •  2,056 2,056
  • Gainesville Florida USA
    • View Profile
Re: Sub Programs
« Reply #2 on: February 21, 2009, 07:04:33 PM »
Hi, Ernie

Hears an Example to look at.

G90 G80 G40 ;set's Mach to proper mode
G91.1 ;set's Mach to proper mode

G00 x0 y0 z0 ; First Location
M98 P12 L1 ; Subroutine Call,"P" set's file name to "O10", "L" set's repeat times

G00 x0 y1 z0 ; Second Location
M98 P12 L1 ; Subroutine Call,"P" set's file name to "O10", "L" set's repeat times

G00 x0 y0 z0 ; Start Location
M30 ; end & rewind G-code
% ; end of G-code

o12;-----------Subroutine
g91 ; INC mode set
g01 z-.0 f59
g01 z-.05 f59
g01 x-.5 y0 z0 
g01 z-.05 f59
g00 x.5 y0 z0
g01 z.1 f50
G90 ; ABS mode set
m99 ; ---- Subrutine Return
%

Chip