12238
Mach3 Subroutine Example
Subroutines can contained in the gcode file being run, or in the c:\mach3\subroutines\ folder.
EXAMPLE RUNNING SUB-ROUTINE IN THE SAME GCODE FILE:
%
O0001(MAIN PROGRAM)
G00 G90 G43
etc..
M98 P0002 L1 (call to sub routine, with L being number of times to run it)
M30
O0002 (SUB PROGRAM)
(SOME CODE)
M99 (return to main program)
%
EXAMPLE RUNNING SUB-ROUTINE FROM EXTERNAL FILE:
%
G54
M6 T1
G43 H1
M98 (subtest.tap) L2 (call to subroutine external file in subroutines folder, with L being number of times to run it)
M30
%
THIS CODE USES X,Y, AND Z IN A TRIANGLE PATH:
Adjust L on M98 line for number of times to run.
Adjust F on G01 line for feedrate
Adjust x,y,z positions for more or less distance
%
O0001 (MAIN PROGRAM)
G01 G91 F50
M98 P0002 L10 (call to sub routine, with L being number of times to run it)
M30
O0002 (SUB PROGRAM)
x5 y5 z3
y-5 z-3
x-5
M99 (return to main program)
%