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.
| Property | Value |
|---|---|
| Code | G65 |
| Function | Macro Call (Non-Modal) |
| Modal group | 00 |
| Type | One-shot (non-modal) — active only in its own block |
| Used on | Mills and lathes |
| Syntax | G65 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
G65 P_ L_ A_ B_ ...| Address | Meaning |
|---|---|
P | Macro program number |
L | Repeat count |
A–Z | Arguments mapped to local variables #1–#26 |
G65 example program
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.