← Back to CNC Programming

Controller Dialects

G-code is not universal. FANUC/Haas, Siemens, and Heidenhain share the same CNC concepts — coordinates, motion, offsets, cycles — but differ in cycle syntax, parameter names, and program structure. This page uses Haas (FANUC-compatible) as the reference and flags what to verify before porting.

Concept

CNC programming has a common core: Cartesian coordinates, G00/G01 motion, work offsets, tool offsets, and cycles. The words used to express that core vary by controller and by machine builder. This page uses Haas mill/lathe syntax as the reference and points out where other controls differ. Always verify against the manual for your specific control version.

Why It Matters

A programmer who knows one control can usually read another, but writing directly for an unfamiliar one without the manual causes alarms or crashes. Canned cycles, subprogram calls, and variable symbols are the main areas where syntax diverges. Copying code from the internet without checking the dialect is a common cause of first-part problems.

How It Works

The Major Controllers at a Glance

AreaFANUC / Haas (reference)Siemens SinumerikHeidenhain TNC
Drilling cycleG81 / G83 with R, Z, Q wordsNamed cycle calls (e.g. CYCLE81/82/83) with a parameter listConversational (Klartext) drill block filled on screen
Subprogram callM98 Pnnnn / M99Procedure/label call per Siemens programming manualLabel call per Heidenhain Klartext manual
Program variables#1, #2R parameters (R1, R2)Q parameters in Heidenhain dialect
Work offsetsG54–G59Work offset frames; G54-style offsets also used in Siemens examplesDatum table on the control
Feed per rev (lathe)FANUC: verify the selected G-code system; Haas lathe: G99Per Siemens lathe programmingPer Heidenhain manual
Concept Mapping (not executable code) Same hole: X10 Y10, top Z0, depth Z-15, approach Z2, retract Z50, F100 FANUC/Haas G81 X10 Y10 R2. Z-15. F100 look up: R, Z, F, retract G98/G99 Siemens named cycle call (e.g. CYCLE81/82) look up: cycle name, parameter order, dwell, feed, retract Heidenhain conversational block filled on screen look up: TNC block fields for depth, feed, approach

FANUC / Haas

FANUC-style controls use Oxxxx program numbers, G80–G89 cycles, and M98 P subprogram calls. On Haas lathes G99 selects feed-per-rev; on a FANUC-style lathe the feed-per-rev G-code depends on the configured G-code system and must be checked in the relevant manual — do not assume G95 or G99 from the brand name. Haas thread cycles use the one-line G76 with K/D words. The exact G-code set depends on the control model and option board; verify on your machine.

Siemens Sinumerik

Siemens controls (828D, 840D, Sinumerik ONE) use named cycle calls rather than G81 numbers. Variables are R parameters. Siemens programs can still use G17, G54, and M30 in standard ways; the difference is in cycle calls and offset frame syntax. Do not assume a FANUC G81 program runs unchanged — the drilling sequence must be rewritten as the corresponding Siemens cycle call with the correct parameter list for your exact software version.

Heidenhain TNC

Heidenhain controls (TNC 640, iTNC 530) use Klartext conversational programming: the operator enters plain-language blocks on the screen rather than writing raw G-code. Q parameters are used. The control can also read G-code programs, but native TNC programs are conversational text blocks, not touch-probe cycles.

What Transfers and What Does Not

The right-hand coordinate system, the geometric idea of a working plane, the work-offset concept, and tool-length/radius offset concepts transfer across controls. The specific plane G-codes G17/G18/G19, cycle numbers, and parameter order must still be checked for your dialect. What does not transfer without checking: cycle numbers and parameter order, subprogram call syntax, variable symbols, M-codes for chuck/tailstock/pallet, and exact retract behavior. CAM post-processors handle this translation automatically; hand-written programs must be ported line by line.

Example: Porting a Drilling Hole

Entry conditions for this snippet: after the startup block (G21/G17/G90/G94/G40/G49/G80), a valid tool length offset has been re-established with G43 H; the spindle is running in the drilling direction and speed, required coolant is available, and fixture clearances are verified. The tool starts at a safe Z above the work. The example retracts to the initial plane (G98); because the initial plane here is Z50, the first safe Z move must be established explicitly before any XY positioning.

FANUC/Haas reference:

G90 G54 G00 Z50.
G00 X10. Y10.
G98 G81 R2. Z-15. F100.
G80

For Siemens, select the equivalent named cycle (e.g. CYCLE81 for drilling without dwell, or CYCLE82 with dwell) and fill its parameter list from the SINUMERIK programming manual for your exact software version. For Heidenhain, enter the drilling block as a Klartext conversational line on the control. Do not copy the FANUC G81 line directly.

Post-Processors Hide the Dialect

In a modern shop, most programs come from CAM software. The post-processor translates the generic toolpath into the syntax of the target machine. A CAM post configured for a Haas mill outputs G81; the same CAM post for a Siemens machine outputs the named cycle. This is why CAM programs usually do not need hand porting. When you write G-code manually, you are doing the post-processor's job by hand.

Reading Alarm Messages

When a program alarms, read the alarm number and text from your control manual. Alarms are control-specific: a FANUC alarm, a Siemens alarm, and a Heidenhain alarm use different numbering. Many alarms are setup errors (wrong offset, tool not clamped, door open) rather than program errors. The alarm manual for your exact control is the first diagnostic reference.

Common Mistakes

Practice

1. What does M98 P2000 do on a Haas?

Show answer

Calls subprogram O2000 once. The P-address specifies the program number.

2. Why should you not assume G-code from one machine works on another?

Show answer

Cycle formats, parameter meanings, and M-codes vary by control and machine builder. Verify against the manual for your specific control version.

3. What variable symbol does Siemens use instead of FANUC #1?

Show answer

R parameters (R1, R2). Heidenhain uses Q parameters in its own dialect.

Sources