G-code reference

G65 G-Code: Macro Call (Non-Modal)

Macro Call (Non-Modal) — Calls a custom macro program and passes arguments as local variables (A→#1, B→#2, C→#3, D→#7, …). It is the basis of probing cycles and parametric programs.

By cnccode · Updated
PropertyValue
CodeG65
FunctionMacro Call (Non-Modal)
Modal group00
TypeOne-shot (non-modal) — active only in its own block
Used onMills and lathes
SyntaxG65 P_ L_ A_ B_ ...

What does G65 do?

Calls a custom macro program and passes arguments as local variables (A→#1, B→#2, C→#3, D→#7, …). It is the basis of probing cycles and parametric programs.

G65 is a one-shot code: it only acts in the block where it is written, and the previously active modal codes take over again afterwards.

Syntax and parameters

Format
G65 P_ L_ A_ B_ ...
AddressMeaning
PMacro program number
LRepeat count
A–ZArguments mapped to local variables #1–#26

G65 example program

Example
G65 P9810 Z-10.0 F1000. (Renishaw protected move)
G65 P8000 A10.0 B5.0 (custom macro)

▶ Open this example in the G-code viewer

Tips and common mistakes

  • Requires Custom Macro B (standard on most modern controls).
  • Arguments G, L, N, O, P cannot be passed.

Controller compatibility

G65 follows the ISO/Fanuc dialect used by Fanuc, Haas, Brother, Doosan, Hurco (ISO mode), Mazak (EIA/ISO mode), Okuma (G-code mode) and Siemens in ISO dialect mode. Parameters, option packages and builder-specific behaviour can differ, so confirm the details in your machine's programming manual before running a new program.

Frequently asked questions

Is G65 modal?
No. G65 is a one-shot (group 00) code and only acts in the block where it appears.
What does G65 mean in CNC?
G65 means Macro Call (Non-Modal). Calls a custom macro program and passes arguments as local variables (A→#1, B→#2, C→#3, D→#7, …). It is the basis of probing cycles and parametric programs.
What is the difference between G65 and G66?
G65 is Macro Call (Non-Modal), while G66 is Modal Macro Call. See the G66 page for its syntax and examples.
Can I use G65 on a lathe?
Yes, G65 is used on both mills and lathes, although some parameters differ between them.