0 votes
in cnc programming by (9.0k points)

In this article, we describe how to call macro program on Haas CNC Machines which is called G65 code.

G65 is the command that calls a subprogram with the ability to pass arguments to it. The
format follows:

G65 Code Format

G65 Pnnnnn [Lnnnn] [arguments] ;

Arguments italicized in square brackets are optional. See the Programming section for
more details on macro arguments.
The G65 command requires a P address corresponding to a program number currently
located in the control’s drive or path to a program. When the L address is used the macro
call is repeated the specified number of times.
When a subprogram is called, the control looks for the subprogram on the active drive or the path to the program. If the subprogram cannot be located on the active drive, the control looks in the drive designated by Setting 251. Refer to the Setting Up Search Locations section for more information on subprogram searching. An alarm occurs if the control does not find the subprogram.

In Example 1, subprogram 1000 is called once without conditions passed to the subprogram. G65 calls are similar to, but not the same as, M98 calls. G65 calls can be nested up to 9 times, which means, program 1 can call program 2, program 2 can call program 3 and program 3 can call program 4.

G65 Example – 1

G65 P1000 (Call subprogram O01000 as a macro) ;
M30 (Program stop) ;
O01000 (Macro Subprogram) ;

M99 (Return from Macro Subprogram) ;

G65 Example – 2

In Example 2, the program LightHousing.nc is called using the path that it is in.
G65 P15 A1. B1.;
G65 (/Memory/LightHousing.nc) A1. B1.;
Note : Paths are case sensitive.

G65 Example – 3

In Example 3, subprogram 9010 is designed to drill a sequence of holes along a line whose
slope is determined by the X and Y arguments that are passed to it in the G65 command
line. The Z drill depth is passed as Z, the feed rate is passed as F, and the number of holes
to be drilled is passed as T. The line of holes is drilled starting from the current tool position
when the macro subprogram is called.
Note : The subprogram program O09010 should reside on the active drive or on a drive designated by Setting 252.
G00 G90 X1.0 Y1.0 Z.05 S1000 M03 (Position tool) ;
G65 P9010 X.5 Y.25 Z.05 F10. T10 (Call O09010) ;
M30 ;
O09010 (Diagonal hole pattern) ;
F#9 (F=Feedrate) ;
WHILE [#20 GT 0] DO1 (Repeat T times) ;
G91 G81 Z#26 (Drill To Z depth) ;
#20=#20-1 (Decrement counter) ;
IF [#20 EQ 0] GOTO5 (All holes drilled) ;
G00 X#24 Y#25 (Move along slope) ;
N5 END1 ;
M99 (Return to caller) ;

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.