Free tool
G-code quick reference
The G codes, M codes and address words the TNC-M34 milling controller and the TNC-L32 lathe controller interpret: what each does, which are modal, and where the two controllers differ.
Yes means that controller's manual documents the code as described. Differs means it is documented, and says how it differs. Not listed means that manual does not mention it, which is not proof the controller cannot run it.
No codes matchTry a code such as G84, or a word such as thread.
Motion
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| G0 | Rapid | Rapid move to the programmed point. | Motion | Yes | Yes |
| G1 | Linear feed | Straight move at the feed rate. Refused when no F has been set, rather than run at full axis speed. | Motion | Yes | Yes |
| G2 | Arc, clockwise | Centre given by I/J/K offsets, or radius by R. An R too small to reach the end point refuses the program; an R arc whose start and end coincide is read as a full circle. | Motion | Yes | Yes |
| G3 | Arc, counter-clockwise | As G2, turning the other way. | Motion | Yes | Yes |
| G4 | Dwell | Wait for P seconds. | Yes | Yes | |
| G28 | Go to reference | Return to the reference position. | Yes | Yes | |
| G28.1 | Set reference | Set the reference position, held in RAM. | Yes | Not listed | |
| G30 | Go to reference | Return to reference; both manuals list it alongside G28. | Yes | Yes | |
| G30.1 | Set reference | Set the reference position, held in RAM; listed with G28.1. | Yes | Not listed | |
| G32 | Threading | Listed with G33 as threading, K being the pitch. | Not listed | Yes | |
| G33 | Thread pass | Z follows the spindle's angle, one pitch per revolution. Pitch by K or F, refused without one. Each pass waits for the spindle index, and feed override does not apply. | Motion | Not listed | Yes |
Plane, units, distance and path mode
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| G7 | Diameter mode | X words are diameters. The default comes from the X PROGRAM setting, shipped as diameter. | Radius/diameter | Not listed | Yes |
| G8 | Radius mode | X words are radii. How the DRO shows X is a separate setting. | Radius/diameter | Not listed | Yes |
| G17 | XY plane | Arcs in the XY plane. On TNC-M34, centre words that contradict the plane are corrected when unambiguous and refused when not. | Plane | Yes | Differs — refused at load |
| G18 | XZ plane | Arcs in the XZ plane. The only plane on TNC-L32, and fixed there. | Plane | Yes | Yes |
| G19 | YZ plane | Arcs in the YZ plane. | Plane | Yes | Differs — refused at load |
| G20 | Inch | Program units are inches. A rotary 4th axis on TNC-M34 stays in degrees. | Units | Yes | Yes |
| G21 | Millimetre | Program units are millimetres. | Units | Yes | Yes |
| G61 | Exact stop | The axes stop fully at the end of every block. On TNC-M34, typed in MDI it also changes the machine's starting path mode. | Path | Yes | Yes |
| G64 | Continuous path | Corners are blended within the junction deviation setting. The default on TNC-M34. | Path | Yes | Yes |
| G90 | Absolute | Coordinates are positions. | Distance | Yes | Yes |
| G90.1 | Arc centres absolute | I/J/K are read as absolute. | Yes | Not listed | |
| G91 | Incremental | Coordinates are distances from where the tool is. | Distance | Yes | Yes |
| G91.1 | Arc centres incremental | I/J/K are read as incremental. | Yes | Not listed |
Feed and spindle-speed modes
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| G50 | Spindle speed clamp | G50 S sets the highest rpm the spindle may reach, which constant surface speed needs as X approaches zero. | Offsets | Differs — scaling off; accepted and ignored | Yes |
| G93 | Inverse-time feed | Each move takes exactly 1/F minutes. | Yes | Not listed | |
| G94 | Feed per minute | F is units per minute. | Feed | Yes | Yes |
| G95 | Feed per revolution | F is mm per spindle revolution. On TNC-L32 the measured spindle sets the rate, and a stalled spindle aborts the job. | Feed | Differs — refused at load | Yes |
| G96 | Constant surface speed | S is a surface speed, so the rpm rises as X gets smaller. Set a ceiling with G50 S. | Spindle | Not listed | Yes |
| G97 | Fixed rpm | S is spindle rpm. | Spindle | Not listed | Yes |
Canned cycles: drilling, boring and tapping
On TNC-M34 a canned cycle is modal: X/Y lines after it are further holes, until G80. R is the retract plane, Q the peck, P a dwell in seconds, and G98 (the default) returns to the starting Z. TNC-L32 cycles are one-shot and are expanded into ordinary moves when the file loads.
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| G73 | Peck drill, chip break | Pecks with a partial retract to break the chip. | Modal cycle | Yes | Differs — pattern repeat, not built; refused |
| G74 | Left-hand rigid tap | Rigid tapping with the spindle in M4. Needs a STEP spindle; refused in the other spindle modes. | Modal cycle | Yes | Differs — face grooving cycle (see lathe cycles) |
| G76 | Fine boring | A mill boring cycle. TNC-M34 refuses the program rather than skip a modal cycle and every hole after it. | Differs — refused at load | Differs — threading cycle (see lathe cycles) | |
| G80 | Cancel cycle | Ends the active canned cycle. | Yes | Differs — accepted as a no-op; cycles are one-shot | |
| G81 | Drill | Plain drilling at each X/Y point. | Modal cycle | Yes | Not listed |
| G82 | Drill with dwell | Drill, dwelling P seconds at depth. | Modal cycle | Yes | Not listed |
| G83 | Peck drill, full retract | Pecks with a full retract after each, so the flutes clear. The cycle for deep holes. | M34 modal, L32 one-shot | Yes | Differs — centreline only, no X; Q in µm, P in ms |
| G84 | Rigid tapping | Z and spindle move locked together, one pitch per revolution, with no M code emitted. The spindle must be running. Without a STEP spindle, TNC-M34 runs the motion only and TNC-L32 will not run it. | M34 modal, L32 one-shot | Differs — M3 only (M4 is G74); pitch K, or F with S | Differs — centreline only; K or F is the pitch; M3 or M4 |
| G85 | Bore, feed out | Feed in and feed back out. | Modal cycle | Yes | Not listed |
| G86 | Bore | Motion only: the spindle is not stopped at depth. | Modal cycle | Yes | Not listed |
| G87 | Back boring | Neither controller runs it. | Differs — refused at load | Differs — side drilling, not built; blocks the run | |
| G88 | Bore | Motion only, as G86: the spindle is not stopped at depth. | Modal cycle | Yes | Not listed |
| G89 | Bore, dwell, feed out | Dwell at depth, then feed out. | Modal cycle | Yes | Not listed |
| G98 | Retract to initial Z | Canned cycles return to the Z they started from. The default on TNC-M34. | Retract | Yes | Yes |
| G99 | Retract to R | Canned cycles return only to the R plane. | Retract | Yes | Yes |
Lathe cycles: roughing, grooving and threading
TNC-L32 expands these into ordinary moves when the file loads, so the toolpath plot shows every pass. G71 and G72 name their profile by sequence number, P the first N and Q the last, and G70 finishes the same lines.
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| G70 | Finish profile | The finish pass over the profile a G71 or G72 roughed. | One-shot | Not listed | Yes |
| G71 | Rough turning | Roughs a profile by turning. A profile that reverses in the cut axis is refused. | One-shot | Not listed | Yes |
| G72 | Rough facing | Roughs a profile by facing. | One-shot | Not listed | Yes |
| G73 | Pattern repeat | Listed in the TNC-L32 cycle table but not built yet; a program using it is refused by name. | Differs — peck drilling (see drilling cycles) | Differs — not built; refused by name | |
| G74 | Face peck grooving | Grooves a face in pecks. With X left out it peck drills with a chip-break back-off of R, faster than G83 for shallow holes. | One-shot | Differs — left-hand rigid tapping | Yes |
| G75 | OD peck grooving | Grooves the outside diameter in pecks. | One-shot | Not listed | Yes |
| G76 | Threading cycle | A multi-pass thread with constant-area infeed. P carries spring passes. With no parameter block it uses its own defaults and says so on the panel. | One-shot | Differs — fine boring, refused at load | Yes |
Tool offsets and compensation
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| G10 L1 | Write tool length | G10 L1 P… Z… sets the length of tool P (0–6) in the tool table, and it survives power-off. | Yes | Not listed | |
| G40 | Compensation off | Cancels compensation. TNC-M34 never turns it on, so accepts G40 and does nothing. | Compensation | Yes | Yes |
| G41 | Compensation, left | Offsets the path to the left of travel. On TNC-L32 it is nose-radius compensation, for boring and facing outward; put it on the approach move. | Compensation | Differs — refused at load | Yes |
| G42 | Compensation, right | Offsets the path to the right of travel. On TNC-L32 this is OD turning, whichever side the toolpost is on. | Compensation | Differs — refused at load | Yes |
| G43 | Tool length offset on | G43 H… applies that tool's length to Z. It shifts what the program commands, not what the DRO shows. | Yes | Not listed | |
| G49 | Tool length offset off | Cancels G43. Probe a work datum with G49 in force. | Yes | Not listed |
Work coordinates and offsets
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| G10 L2 | Set work offset | G10 L2 P… X/Y/Z sets work system P, where 1–6 are G54–G59. | Yes | Not listed | |
| G52 | Local offset | Adds a local offset on top of the work system. The DRO does not include it. | Yes | Not listed | |
| G53 | Machine coordinates | Moves in machine coordinates, for this block only. | One-shot | Yes | Yes |
| G54 | Work system 1 | Selects work coordinate system 1 (P1 for G10 L2). | WCS | Yes | Yes |
| G55 | Work system 2 | Selects work coordinate system 2 (P2). | WCS | Yes | Yes |
| G56 | Work system 3 | Selects work coordinate system 3 (P3). | WCS | Yes | Yes |
| G57 | Work system 4 | Selects work coordinate system 4 (P4). | WCS | Yes | Yes |
| G58 | Work system 5 | Selects work coordinate system 5 (P5). | WCS | Yes | Yes |
| G59 | Work system 6 | Selects work coordinate system 6 (P6). | WCS | Yes | Yes |
| G92 | Set position | Sets an offset on top of the work system. On TNC-M34 the DRO keeps reading against the work system alone. | Offsets | Yes | Yes |
| G92.1 | Clear G92 | Clears the G92 offset. | Yes | Not listed |
Probing
On TNC-M34, probing runs from MDI or the macro PROBE verb; inside a program a G38 line is skipped and reported. One axis per block, and the number is a distance, not a coordinate: G38.2 Z-30. F is ignored: the TOOL ZERO settings give a fast pass, a back-off and a slow pass, and the slow pass gives the result. On TNC-L32 a G38 line in a program is refused, and the probe cycle is reached through its macro PROBE verb.
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| G38.2 | Probe toward, with error | Moves toward the work until the probe trips. No contact is an error, with a retract. | Yes | Differs — refused in a program; use macro PROBE | |
| G38.3 | Probe toward, no error | As G38.2, but no contact is not an error; check #probe_hit. | Yes | Differs — refused in a program; use macro PROBE | |
| G38.4 | Probe away, with error | Moves away until contact is lost. Never losing it is an error, with a retract. | Yes | Differs — refused in a program; use macro PROBE | |
| G38.5 | Probe away, no error | As G38.4, without the error. | Yes | Differs — refused in a program; use macro PROBE |
Polar, scaling and rotation
TNC-M34 refuses these modal codes at load, naming the code and the line, because each changes how every later line is read. Their cancel forms are accepted and ignored, since nothing was turned on.
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| G15 | Polar off | Cancels polar coordinates. | Differs — accepted and ignored | Not listed | |
| G16 | Polar coordinates | X and Y become radius and angle on every later line. | Modal | Differs — refused at load | Not listed |
| G50 | Scaling off | Cancels scaling. | Differs — accepted and ignored | Differs — spindle speed clamp (see feed modes) | |
| G51 | Scaling | Scales every later coordinate. | Modal | Differs — refused at load | Not listed |
| G68 | Rotation | Turns the whole coordinate frame. | Modal | Differs — refused at load | Not listed |
| G69 | Rotation off | Cancels rotation. | Differs — accepted and ignored | Not listed |
M codes: program, spindle, coolant and I/O
An M code a controller does not have is skipped with a message rather than treated as an error. On TNC-M34 any motion on the same line still runs.
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| M0 | Program stop | Stops the program. | Yes | Yes | |
| M1 | Optional stop | Stops only when optional stop is on (the opt_stop setting on TNC-M34). | Yes | Yes | |
| M2 | Program end | Ends the program. | Yes | Yes | |
| M3 | Spindle clockwise | Starts the spindle clockwise at S. A step-driven spindle ramps to speed instead of jumping. | Spindle | Yes | Yes |
| M4 | Spindle counter-clockwise | Starts the spindle counter-clockwise. On a step-driven spindle a change of direction ramps down through zero and back up. | Spindle | Yes | Yes |
| M5 | Spindle stop | Stops the spindle. | Spindle | Yes | Yes |
| M6 | Tool change | What happens is set in the controller's configuration. | Differs — ignore, pause, or run toolchange.mac, per tool_change | Differs — stops only in MANUAL change mode | |
| M7 | Mist on | Turns mist coolant on. | Coolant | Yes | Yes |
| M8 | Flood on | Turns flood coolant on. | Coolant | Yes | Yes |
| M9 | Coolant off | Turns mist and flood off. | Coolant | Yes | Yes |
| M13 | Spindle and coolant, clockwise | Spindle clockwise and flood on together: M3 plus M8. | Yes | Yes | |
| M14 | Spindle and coolant, counter-clockwise | Spindle counter-clockwise and flood on together: M4 plus M8. | Yes | Yes | |
| M30 | Program end | Ends the program; both manuals list it with M2. | Yes | Yes | |
| M48 | Overrides enabled | Lets the operator's feed and speed overrides act. | Yes | Differs — manual names feed override only | |
| M49 | Overrides disabled | Locks out the feed and speed overrides. | Yes | Differs — manual names feed override only | |
| M62 | Output on, with motion | Sets output P (0–15 on TNC-M34), synchronised with motion. | Yes | Differs — P is pin 0–7 | |
| M63 | Output off, with motion | Clears output P, synchronised with motion. | Yes | Differs — P is pin 0–7 | |
| M64 | Output on, now | Sets output P immediately. | Yes | Differs — P is pin 0–7 | |
| M65 | Output off, now | Clears output P immediately. | Yes | Differs — P is pin 0–7 | |
| M66 | Wait for input | Waits on input P. | Yes | Differs — P is pin 0–7 |
Address words
| Code | Name | What it does | Modal | TNC-M34 | TNC-L32 |
|---|---|---|---|---|---|
| A B C | 4th axis | The 4th axis answers to whichever letter is configured; a rotary axis is in degrees. With a STEP spindle it is C, and is the spindle. Another rotary letter loads with a warning and will not start. | Yes | Differs — refused at load | |
| F | Feed | Feed rate, in the units of the feed mode. A feed move with no F in effect is refused. For a thread or tap, see G33 and G84. | Modal | Yes | Yes |
| H | Tool length number | The tool whose length G43 applies, 0–6. | Yes | Not listed | |
| I | Arc centre, X | Arc centre along X. | Yes | Yes | |
| J | Arc centre, Y | Arc centre along Y. | Yes | Not listed | |
| K | Arc centre Z, or pitch | Arc centre along Z. Also the pitch, mm per revolution, for G84 and on TNC-L32 for G33. | Yes | Yes | |
| L | G10 target | What G10 writes: L1 the tool table, L2 a work offset. | Yes | Not listed | |
| M | Machine function | An M code; see the table above. | Yes | Yes | |
| N | Sequence number | Labels a block. G71 and G72 name their profile by it. | Not listed | Yes | |
| P | Dwell, or a number | Dwell in seconds for G4 and the cycles; the tool or work system G10 writes; the pin for M62–M66. | Yes | Differs — ms in G83; first N in G71/G72; spring passes in G76 | |
| Q | Peck | Peck increment in drilling cycles; ignored when tapping. | Yes | Differs — µm in G83 (Q3000 is 3 mm); last N in G71/G72 | |
| R | Radius, or retract | Arc radius; on TNC-M34 a negative R takes the long way round. In a canned cycle, the retract plane. | Yes | Differs — G83 re-entry clearance (1 mm default); G74 back-off | |
| S | Spindle speed | Spindle rpm. On TNC-M34 a lone S retargets a running spindle. | Yes | Differs — surface speed under G96; rpm limit with G50 | |
| T | Tool | Selects a tool. T0102 is geometry 1 with wear register 2. The control retracts before the offset changes. | Not listed | Yes | |
| U | Incremental X | An incremental X move. | Differs — not an axis; loads with a warning, will not start | Yes | |
| W | Incremental Z | An incremental Z move; in G83 and G84, an incremental hole bottom. | Differs — not an axis; loads with a warning, will not start | Yes | |
| X | X axis | X position. | Yes | Differs — a diameter by default (G7/G8) | |
| Y | Y axis | Y position. | Yes | Differs — refused at load | |
| Z | Z axis | Z position; the hole bottom in drilling and tapping cycles. | Yes | Yes |
Differences between TNC-M34 and TNC-L32
The TNC-M34 is a four-axis milling control and the TNC-L32 a two-axis lathe control, so many codes exist on only one. These are the places where both manuals use the same number, or the same job, differently.
| Topic | TNC-M34 | TNC-L32 |
|---|---|---|
| Plane and X words | Arcs in G17, G18 or G19. X is a position. | G18 only; G17 and G19 are refused. X is a diameter by default (G7/G8). U and W are incremental X and Z. Y, A, B and C are refused. |
| Feed per revolution and surface speed | G95 is refused at load. No G96. G50 means scaling off and is ignored. | G95 feeds per revolution of the measured spindle. G96 holds surface speed, G50 S caps the rpm, G97 returns to fixed rpm. |
| Canned cycles | Modal: X/Y lines after a cycle are further holes until G80. | One-shot, expanded when the file loads, so the plot shows every pass. G80 is accepted and does nothing. |
| Same number, different cycle | G73 peck drill. G74 left-hand tap. G76 fine boring and G87 back boring, both refused. | G73 pattern repeat, not built. G74 face grooving. G76 threading. G87 side drilling, not built. |
| Peck drilling, G83 | At each X/Y hole. Q is the peck, P a dwell in seconds, R the retract plane. | On the centreline, with no X. Q is in microns, P in thousandths of a second, R the clearance on re-entry; it retracts to where the cycle started. |
| Rigid tapping, G84 | Needs a STEP spindle. X/Y hole, R plane, pitch K or F with S. G84 with M3, G74 with M4. A feed hold stops Z and spindle together; HOLD then REVERSE backs the tap out. Other spindle modes run the motion only, with a warning. | Needs DRIVE = STEP. Centreline, pitch K or F, M3 or M4. A feed hold waits for the pass to end. The hole ends deeper than Z by pitch × rpm² ÷ (120 × SPIN ACCEL). On an analog spindle it loads but will not run. |
| Compensation and tool offsets | G41 and G42 are refused; G40 is accepted. Tool length by G43 H and G49, written with G10 L1. | G41 and G42 give nose-radius compensation. Tool geometry and wear come with the T word, such as T0102. |
| Tool change | M6 ignores, pauses, or runs toolchange.mac, as the tool_change setting says. | A T word selects the offset and retracts first. M6 stops only in MANUAL change mode. |
| Threading | Not listed. | G33 and G32 passes locked to the spindle index, and the G76 cycle. |
| Probing | G38.2 to G38.5 from MDI or macro PROBE. In a program the line is skipped and reported. | G38 in a program is refused, not built yet. The probe cycle is reached from a macro. |
| Codes it does not know | An unknown G with coordinates: that line is skipped and the program continues. Alone on its line: silently ignored. An unknown M: the action is skipped, motion on the line runs. | An unknown G with coordinates blocks the run. Without coordinates it is ignored with a NOTE on the panel. An unknown M is skipped with a NOTE. |
| Outputs and inputs | M62–M66 with P 0–15. | M62–M66 with P as pin 0–7. |
Macros and subprograms
Neither manual documents G-code subprogram calls. Both controllers run macros instead: plain-text .mac files of short commands such as PROMPT, PROBE and IF … GOTO, with ; comments, started from the panel. On TNC-M34 an M6 can run toolchange.mac; on TNC-L32 a macro line that is not a verb is passed to the G-code parser.
Example blocks
Neither manual prints a complete program. These blocks are quoted from them.
TNC-M34 Operator Manual
Rigid-tap a hole on a STEP spindle (Appendix B), an incremental MDI move that a following X5 repeats (section 9), a probe touch-off, and a tool length written by hand (Appendix B):
M3 S500 G84 X… Y… Z-15 R2 K1.5 G91 G1 X5 F200 X5 G38.2 Z-30 G10 L1 P<tool> Z<value>
TNC-L32 operator manual
Start the spindle to skim a diameter (section 3b), select the master tool (section 4), and the MDI and G76 lines drawn on the panel (section 1):
M3 S600 T0101 G0 X50 Z2 N142 G76 X17.4 Z-25 P1227
Sources: TNC-M34 Operator Manual, firmware V1.3 (build 22); TNC-L32 operator manual, firmware 0.1, revised 2026-09-09. Controllers: TNC-M34 four-axis milling controller and TNC-L32 two-axis lathe controller.