Originally Posted by
guido5286
Still looking for a little help with the subroutines.
If you are familiar with sub programs, user subroutines will feel familiar. Instead of being a separate program, they are inside the program all the way at the top. In Format 2 (maybe 1 also??) they are separated from the main program by an M30. They have a special end of subroutine function denoted by M17
Code:
L100 ( FIRST SUBROUTINE )
G91
X0.5 Y0.866
G90
M17 ( END OF SUB 1 )
L200 ( SECOND SUBROUTINE )
G91
X-1
G90
M17 ( END OF SUB 2 )
L300 ( THIRD SUBROUTINE )
G91
X0.5 Y-.866
G90
M17 ( END OF SUB 3 )
M30 ( END OF ALL SUBROUTINES )
G20 ( FIRST LINE OF MAIN PROGRAM )
G0 G17 G40 G80 G90 (SAFE CODE, USE YOUR OWN! )
T1 M6 (TOOL CHANGE )
S1000 M3 (SET SPINDLE SPEED )
G90 E1 X0 Y0 ( RAPID TO FIXTURE 1, CAN USE G54 INSTEAD OF E1 )
G43 Z3.5 H1 (THE H AND THE G43 ARE TOTALLY REDUNTANT, USE H ALWAYS )
M8
Z0.25 D1
G1 Z-1. F25.
L101 ( RUN SUB 1 ONCE )
L201 ( RUN SUB 2 ONCE )
L301 ( RUN SUB 3 ONCE )
L102 ( RUN SUB 1 TWICE )
L202 ( RUN SUB 2 TWICE )
L302 (RUN SUB 3 TWICE )
G0 Z0.25
M5 M9
G53 Z0
Y8.5 E48
T1 M6
M30