Mazak EIA/ISO (G-Code) Programming — MAZATROL SmoothAi

Every Mazak machining center that ships with the EIA/ISO option runs two programming languages side by side: the conversational MAZATROL program the control is famous for, and standard EIA/ISO G-code — the same ISO dialect posted by any CAM system. This page covers the G-code side on the SmoothAi and SmoothG controls: how EIA programs are stored and selected, the G-code and M-code vocabulary, the drilling/boring canned cycles, and Mazak’s user-macro language (#-variables, arithmetic, IF/WHILE). Where Mazak’s dialect diverges from a Fanuc, those points are called out — do not assume a Fanuc habit carries over. See also the Mazak Control Guide for control operation.

How EIA/ISO Mode Works on a Mazak

On a MAZATROL control, a stored program is either a MAZATROL program (a conversational unit sequence) or an EIA/ISO program (line-oriented G-code). The control decides which interpreter to use from the program’s own content — there is no global “G-code mode” switch equivalent to Fanuc’s. You select the program to run from the program directory; a MAZATROL program opens in the conversational editor, an EIA program opens as a text-style G-code listing.

An EIA/ISO program is identified by a program number of the form O followed by an unsigned integer (the format spec permits up to eight digits, O8), or by a program name of up to 32 characters. The first significant line is typically a comment header in parentheses naming the part, followed by the setup block. A real Mazak header from a maker-supplied probing routine:

(O207409921 REN X DIAM)
(COPYRIGHT*2015-2017*RENISHAW*PLC.*ALL*RIGHTS*RESERVED)
M98P207409923          ; call a subprogram by O-number
#1=#5041               ; read present workpiece X into a local variable
...
M99                    ; return to caller (subprogram) / rewind (main)

EIA and MAZATROL programs coexist and can call each other. An EIA program calls a MAZATROL program the same way it calls any subprogram; the reverse is also supported. One rule the manual is emphatic about: when a MAZATROL program is called from an EIA/ISO program, the MAZATROL END unit must have CONTI. = 1 so control returns cleanly to the EIA main program — never put an M99 in the MAZATROL program to force the return.

Block and word rules that bite when hand-editing: a “word” with an address but no number (e.g. G28XY) is, by default (parameter F36 bit 3 = 0), treated as G28X0.Y0.; set that bit to 1 and the same block throws alarm 807 ILLEGAL FORMAT. Coordinate values without a decimal point are interpreted in the least input increment (0.0001 mm / 0.00001 in) — so X10 is 0.001 mm, not 10 mm. Always program a decimal point on dimensional data. G20/G21 (inch/metric) affect program data only; tool and offset data are not converted, so set those in the correct unit beforehand.

G-Code Reference

The following is the everyday subset of the SmoothAi EIA/ISO G-code list, grouped by function. The Group column is the modal group (codes in the same non-zero group are mutually exclusive and modal; group 00 codes are one-shot). Codes marked (option) are only present if the machine builder configured them. This is a working subset — the full list runs to well over a hundred codes including five-axis, turning, inclined-plane, and gear-cutting functions.

G-codeGroupFunction
Interpolation / Motion
G0001Positioning (rapid traverse)
G0101Linear interpolation
G02 / G0301Circular interpolation CW / CCW (also helical with a 3rd axis)
G02.1 / G03.101Spiral interpolation CW / CCW
G02.2 / G03.201Involute interpolation CW / CCW (option)
G06.101Cylindrical interpolation
G0700Circle cutting
G33 / G3401Thread cutting (constant / variable lead)
G6000One-way (unidirectional) positioning
Plane, Units, Feed & Dwell
G17 / G18 / G1902Plane selection X-Y / Z-X / Y-Z
G20 / G2106Inch / metric data input
G15 / G16Polar coordinate command OFF / ON
G12.1 / G13.1Polar coordinate interpolation ON / OFF (option)
G90 / G9103Absolute / incremental data input
G94 / G9505Asynchronous feed (per minute) / synchronous feed (per rev)
G9305Inverse-time feed
G0400Dwell (G04 X_ or P_ = time under G94; X_ = revolutions under G95)
G0900Exact-stop check (one-shot)
G61 / G6413Exact-stop mode / cutting (continuous-path) mode
G61.1 / G62 / G6313High-accuracy mode / automatic corner override / tapping mode
Reference Return & Coordinate Systems
G2700Reference-point return check
G2800Return to 1st reference (home) position via intermediate point
G2900Return from reference point
G3000Return to 2nd / 3rd / 4th reference position
G5300Machine (fundamental) coordinate system selection
G54G5912Workpiece coordinate systems 1–6
G54.1 P_12Additional workpiece coordinate systems (P1–up to P300 with option)
G54.2 P_23Fixture offset selection (option)
G54.4 P_27Workpiece setup error correction (option)
G5200Local coordinate system setting
G9200Coordinate system setting / spindle speed clamp
G68 / G69163-D coordinate conversion ON / OFF (G68.2 inclined-plane, option)
G50 / G5111Scaling / mirror image (see notes)
G50.1 / G51.119Programmable mirror image OFF / ON
G54.2, coordinate rotation G68Programmed coordinate rotation and 3-D conversion share group 16
Tool Compensation & Offset
G4007Tool radius (cutter) compensation OFF
G41 / G4207Tool radius compensation left / right (offset by D-number)
G43 / G4408Tool length offset + / − (offset by H-number)
G43.108Tool length offset in tool-axis direction (option)
G43.4 / G43.508Tool tip point control Type 1 / Type 2 (5-axis, option)
G4908Tool length / tool tip control cancel
G45G4800Tool position offset (extension / reduction / double)
G3700Automatic tool length measurement
Data Setting & Skip
G10 / G1100Programmable data setting ON / OFF (offsets, work coordinates)
G10.9Diameter / radius data input selection (turning)
G22 / G2304Pre-move stroke check ON / OFF
G3100Skip function (stop on skip-signal input; used by probing)
G31.1 / G31.2 / G31.300Multi-step skip 1 / 2 / 3
Macro & Program-Flow G-codes
G65 P_00User macro single (non-modal) call
G66 P_14User macro modal call A (call per motion block)
G66.1 P_14User macro modal call B (call every block)
G6714User macro modal call cancel
Hole-Pattern Cycles
G34.100Hole machining pattern — holes on a circle
G3500Hole machining pattern — holes on a line
G3600Hole machining pattern — holes on an arc
G37.100Hole machining pattern — holes on a grid

Drilling & Boring Canned Cycles

All hole-machining fixed cycles are modal group 09 and are canceled by G80 (or by any group-01 motion code such as G00). Return level is set by G98 (initial point) / G99 (R point). The typical format is G8x Xx Yy Zz Rr Ff [Qq] [Pp] [Ll] where Z is hole bottom, R is the rapid-approach (R) plane, Q is peck depth or shift, and P is a bottom dwell.

CodeCycleNotes
G73High-speed deep-hole drillingPeck by Q, small chip-break retract
G74Reverse (left-hand) tappingSpindle reverses at bottom
G75Boring 1
G76Boring 2 (fine boring, oriented-spindle shift)Shift amount by Q; not the Fanuc G76 threading cycle
G77Back spot facing
G78 / G79Boring 3 / Boring 4
G80Fixed cycle cancel
G81Spot drillingG81 [Xx Yy] Rr Zz
G82Drilling (with bottom dwell)P = dwell
G83Deep-hole (full-retract peck) drillingQ = peck depth
G84TappingRight-hand; feed-per-rev under G95
G84.2 / G84.3Synchronous tapping / synchronous reverse tappingRigid tapping (option)
G85Reaming (bore in and out at feed)
G86Boring 5 (spindle stop at bottom, rapid out)G86 [Xx Yy] Rr Zz [Ptc]
G87Back boring
G88 / G89Boring 6 / Boring 7
G71.1 / G72.1Chamfering-cutter cycles (CW / CCW)

Watch the boring-cycle numbering. Mazak calls G75/G76/G78/G79/G86/G88/G89 “Boring 1–7,” and G74 is reverse tapping. On a Fanuc, G76 is fine boring, G74 is left-hand (counter) tapping, and G75/G78/G79 are not standard mill cycles. Do not assume a Fanuc canned-cycle number means the same thing here — check the cycle behavior in the manual before running a converted program.

M-Codes

The EIA/ISO manual defines a small set of NC-internal M-codes whose behavior is fixed by the control. Everything else (spindle, coolant, tool change, orientation) is a machine-configured miscellaneous function — the manual is explicit that whether such an M-code executes before, during, or after axis motion “depends on the machine specifications.” For those, consult the machine’s operation manual, not the EIA manual.

M-codeFunction
NC-Internal (defined by the EIA/ISO manual)
M00Programmed (unconditional) stop — disables pre-read; press start to resume
M01Optional stop (only when OPTIONAL STOP is on)
M02Program end (resets control; reads back to program head)
M30Program end and rewind (tape) / return to head
M98Subprogram call — M98 P_ H_ L_ or M98 <name> H_ L_
M99Subprogram return (in a main program, loops to the head)
M998Continuous execution after parts-count and work-number search
M999Program chaining (jump to another program)
Machine-Configured (typical — verify per machine)
M03 / M04 / M05Spindle CW / CCW / stop
M06Tool change (usually T_ M06; on many Mazak programs the ATC pot is pre-selected, e.g. T[#20]T00M06)
M08 / M09Coolant ON / OFF
M19Spindle orientation

M00, M01, M02, M30, M998, and M999 all disable buffer pre-read, so a following block is not looked ahead. Real Mazak maker programs also use many machine-specific codes such as M111, M200, M203/M205, M648, and M787 — these are model-specific (probe arm, spindle selection on multi-tasking machines, sensor control) and their meaning must not be guessed; look them up for the specific machine.

User Macros — Variables

Mazak’s EIA/ISO user-macro language uses #-variables that will look familiar to anyone who knows Fanuc Custom Macro B, but the ranges and some system-variable numbers are Mazak-specific — verify them here rather than porting Fanuc numbers blind. A variable holds a value with an effective precision of 8 decimal digits; the null (undefined) variable is #0. A word whose value is an undefined variable (e.g. G#10 where #10 is null) is simply ignored.

RangeClass / Usage
Local & Common Variables
#1#33Local variables — macro-call arguments and scratch; a fresh set per call level (up to 8 nesting levels). Level 0 (main program) has its own set that cannot be passed as arguments
#100#199Common variables — shared across programs; cleared on power-off
#500#999Common variables — shared across programs; retained through power-off
#0Null / empty variable (test with EQ #0)
Macro Interface Signals (PLC I/O)
#1000#1035Interface input signals, read-only (1 = closed, 0 = open). #1032 reads inputs #1000#1031 as one 16/32-bit word
#1100#1135Interface output signals (read/write). #1132 writes #1100#1131 as one word
Control / System Status
#3000Force NC alarm: #3000 = n (MESSAGE), n = 1–6999, message up to 31 chars
#3001 / #3002Integrated time: POWER-ON timer / AUTO-CUT timer (read or write)
#3003Single-block-stop / auxiliary-function-wait suppression
#3004Feed-hold / feedrate-override / G09 enable-disable (cleared to 0 on reset)
#3006Programmed stop with message: #3006 = 1 (MESSAGE)
#3007Mirror-image status per axis (bit-coded, read)
#3009 / #3010Message box — prompt operator for a value (needs parameter F331 bit 7)
#3011 / #3012Date (YYMMDD) / time (HHMMSS)
#3020Tool-data index number of the spindle tool
#3901 / #3902Total machined-parts count / required-parts count
Modal Information
#4000Work (program) number of the main program
#4001#4027Modal G-codes of the pre-read block (e.g. #4006 = G20/G21, #4003 = G90/G91)
#4201#4227Modal G-codes of the block being executed
#4101#4132Other modal data of previous block (#4109 F, #4111 H, #4113 M, #4115 program No., #4120 T)
#4301#4330Other modal data of the executing block (#4313 M, etc.)
#4501#4530Modal data captured at the moment of a macro interruption
Position Information (axis 1–16 = last digit)
#5001#5016End-point coordinates of the previous block (workpiece system; tool-tip, no offset)
#5021#5036Present machine coordinates (read after motion stops)
#5041#5056Present workpiece coordinates (read after motion stops)
#5061#5076Skip-signal position (captured at G31; readable any time after)
#5081#5096Present tool position-offset amount
#5101#5116Servo position deviation
Tool Offset Data
#40001#40000+nTool length / length-A offset (n = tool-data index; up to 960 tools)
#400001#400000+nTool length offset, extended range (up to 4000 tools)
#41001#41000+n / #410001+Tool radius compensation amount
#43001#43000+n / #430001+Tool-life flag (1 = ON, 0 = OFF)
Workpiece-Setup Data Set
#5800Number (1–7) of the currently selected workpiece-setup data set (read-only)
#5801#5878Workpiece-setup-error correction data per data set (see G54.4)

Because Mazak stores tool data by tool-data index (not a fixed offset-register number as on Fanuc), read #3020 or #3022/#3023 to resolve the index for a given tool before indexing into the #40001+ arrays. This is a genuine Mazak/Fanuc difference: there is no direct equivalent of Fanuc’s #2001#2400 fixed tool-offset block.

User Macros — Arithmetic & Flow Control

Assignment takes the form #i = <expression>, where the expression may mix constants, variables, functions, and operators. Up to five nested sets of brackets [ ] per expression (functions count toward that limit). Angles are in degrees.

Operator / FunctionMeaning
Arithmetic & Logical
+ - * /Add, subtract, multiply, divide
OR AND XORBitwise logical sum / product / exclusive-OR (each of 32 bits)
Functions
SIN[ ] COS[ ] TAN[ ]Sine, cosine, tangent (degrees; TAN computed as SIN/COS)
ATAN[ ] (or ATN) / ACOS[ ]Arc-tangent / arc-cosine
SQRT[ ] (or SQR)Square root
ABS[ ]Absolute value
ROUND[ ] (or RND)Round to nearest whole number
FIX[ ] / FUP[ ]Truncate decimals / round decimals up
BIN[ ] / BCD[ ]Convert BCD→binary / binary→BCD
Comparison (in conditional expressions)
EQ NE GT LT GE LE= ≠ > < ≥ ≤

Flow control:

ConstructBehavior
IF[cond] GOTO nBranch to sequence number Nn in the same program if the condition holds (else fall through). GOTO n alone = unconditional. Missing target → alarm 843
IF[cond] THEN … ELSE … ENDIFStructured branch; may enclose both macro and NC statements. Nesting up to 10 deep (11th → alarm 1918); unmatched ENDIF → alarm 1919
WHILE[cond] DOm … ENDmLoop while condition holds. m = 1…127; up to 27 nested levels. Unbalanced DO/END → alarm 868

Macros are called with G65 P_ L_ <arguments> (single call), G66/G66.1 (modal, canceled by G67), or as plain subprograms with M98. Under G65/G66, argument addresses map to local variables like Fanuc: A→#1 B→#2 C→#3 D→#7 E→#8 F→#9 H→#11 I→#4 J→#5 K→#6 M→#13 Q→#17 R→#18 S→#19 T→#20 U→#21 V→#22 W→#23 X→#24 Y→#25 Z→#26. Key difference from M98: G65 passes arguments and changes the local-variable level with call depth, and does not single-block-stop; M98 passes no arguments and keeps the same local-variable level.

A worked macro — a bolt-circle drilling routine using the argument mapping, trig, and a WHILE loop:

(O8001 BOLT CIRCLE)
G65 P8002 X0. Y0. R40. H8 Z-10. F150.   ; center X0 Y0, radius 40, 8 holes

(O8002 SUBMACRO)                        ; X#24 Y#25 R#18 H#11 Z#26 F#9
#30 = 360. / #11                        ; angle step = 360 / hole count
#31 = 0.                                ; running angle
#32 = 1                                 ; hole counter
G90 G81 R2. Z#26 F#9                     ; arm the spot/drill cycle (R plane 2 mm)
WHILE [#32 LE #11] DO1
#33 = #24 + #18 * COS[#31]             ; hole X = Xc + R*cos(angle)
#34 = #25 + #18 * SIN[#31]             ; hole Y = Yc + R*sin(angle)
X#33 Y#34                              ; drill at this position
#31 = #31 + #30
#32 = #32 + 1
END1
G80                                      ; cancel canned cycle
M99

Work Offsets & Tool Data in EIA Mode

EIA/ISO programs use the standard work coordinate systems G54G59, the additional systems G54.1 P1P300 (option), a local shift with G52, and the machine system directly with G53. Offset values are set on the WORK OFFSET / coordinate display, or written from a program with G10 (programmable data setting). Reference return is G28 via an intermediate point — almost every Mazak EIA program opens with an incremental reference return, e.g. G91 G28 Z0. then G28 X0. Y0., before the first tool change.

Tool geometry and wear live in the control’s TOOL DATA, indexed by tool number, and are applied through G43 H_ (length) and G41/G42 D_ (radius). Because the EIA offset addresses (H, D) point into the same shared tool table the MAZATROL side uses, a tool edited for a MAZATROL program changes what an EIA program sees under the same H/D number — the two languages are not sandboxed from each other on tool data. Note also that G20/G21 in a program do not re-scale already-stored tool or offset values.

Real-World Examples

A compact self-contained program — a Mazak spindle condition-check routine that steps through speeds with dwells (adapted from a maker-supplied program). It shows the reference-return preamble, tool call, and G04 dwell in seconds:

(CONDITION CHECK PROGRAM FOR 12000rpm)
T[#20]T00M06        ; tool change, pot number from variable #20
G91G28Z0.           ; incremental reference return, Z
G28X0.Y0.           ; reference return, X and Y
M200                ; (machine-specific: select/ready spindle)
M111                ; (machine-specific)
M03S1000            ; spindle CW, 1000 rpm
G04X60.             ; dwell 60 s
S5000
G04X60.
S9000
G04X60.
S12000
G04X120.            ; dwell 120 s at top speed
M05                 ; spindle stop
M30                 ; end + rewind

A macro/probing excerpt (adapted from a Renishaw X-diameter routine) showing G31 skip moves, reading captured positions from #5041/#5043, tolerance checks with IF[…]GOTO, and a sub-macro call with arguments:

#1=#5041                                ; store present workpiece X
#2=#5043-#116                           ; store present workpiece Z (minus clearance)
IF[#26EQ#0]GOTO2                        ; if Z-arg is null, skip the Z touch
#32=#7/2+#18                            ; half tool dia + overtravel
G31X[[#1*#108]-#32]F#119                ; probe toward -X at feed #119
IF[ABS[#5041-[#1-[#32/#108]]]GE#123]GOTO14   ; over tolerance -> error branch
N2
G65P207409926X[#1-[#7/2]]Q#17S#19      ; call reporting macro with args
G0Z#2                                    ; rapid clear in Z
M99

Note the real-program idiom IF[#4006 EQ 21] that these routines use to branch on metric (G21) vs. inch (G20) mode by reading the modal-G system variable — a clean example of using #4001#4027 in practice.

Gotchas & Fanuc Differences

AreaWhat to watch
EIA vs MAZATROL storageBoth program types share one directory and one tool table. The interpreter is chosen from the program, not a mode switch. When EIA calls a MAZATROL program, the MAZATROL END unit must set CONTI. = 1 — do not use M99 to return.
Boring-cycle numbersG75–G79 and G86–G89 are “Boring 1–7”; G76 is fine boring (not threading); G74 is reverse tapping. Fanuc canned-cycle numbers do not map one-to-one.
Decimal pointsNo-decimal values are in least input increment (0.0001 mm). X10 = 0.001 mm, not 10 mm. A parameter can additionally scale non-decimal data ×10.
Tool-offset variablesNo fixed #2001-style block. Tool data is indexed by tool-data index; resolve it via #3020/#3022/#3023, then read #40001+n (length), #41001+n (radius).
Empty words & F36 bit 3An address with no number is silently treated as 0 by default, or raises alarm 807 if F36 bit 3 = 1. A word whose value is a null (#0) variable is ignored entirely.
G20/G21Affect program data only; stored tool and offset data are not converted on a unit change. Set them in the intended unit first.
Loop / IF limitsWHILE nesting to 27 levels (DO numbers 1–127); IF/ENDIF nesting to 10. Overruns raise alarms 1918/1919/868 — not the Fanuc alarm numbers.
Option-gated codesInvolute interpolation, polar interpolation (G12.1/G13.1), synchronous tapping (G84.2/G84.3), inclined-plane machining (G68.2), fixture offset (G54.2), tool tip control (G43.4/G43.5), turning cycles, and hob milling all require options — a code’s presence in this list does not guarantee it on a given machine.
Machine M-codesOnly M00/M01/M02/M30/M98/M99/M998/M999 are defined by the EIA manual. Spindle/coolant/tool-change and codes like M111/M200/M648 are machine-specific — look them up, don’t assume.

For conversational programming on the same control, see Mazak MAZATROL Programming; for control operation, screens, and setup, see the Mazak Control Guide.

References

  • Yamazaki Mazak, Programming Manual (for Machining Centers) — EIA/ISO, MAZATROL SmoothAi, Manual No. H747PB1000E, 02.2020.
  • Yamazaki Mazak, Programming Manual (for Machining Centers) — EIA/ISO, MAZATROL SmoothG, Manual No. H749PB1003E, 07.2022 (companion control).

Have a question or want to contribute?

Contact us with corrections, additions, or topics you'd like covered.

Get in Touch