Fanuc G-code practice
The decimal point trap
On many Fanuc controls, X10 and X10. are different moves. Without the point, the value is read in the smallest input unit: 0.010 mm on a metric machine. A program written for a control that assumes whole units can therefore move a hundredth of what was meant, or fail with an alarm. The safe habit is to write every axis and feed value with a decimal point. Whether calculator-style input is on is a parameter, so check your machine.
Mill and lathe read some codes differently
On a Fanuc lathe with G-code system A, the most common setting:
- Incremental moves use U and W instead of G91, and X is a diameter.
- G90 is a turning cycle, not absolute mode.
- G92 is a threading cycle, and G50 sets the maximum spindle speed.
- G98 and G99 set feed per minute and per revolution.
- Roughing and finishing use G71, G72 and G70; threads use G76.
Fanuc program format
- Programs are numbered with an O word (
O1001); some number ranges are often protected for macros. - Each block ends with an end-of-block, shown as
;on the control. - Rigid tapping is switched on with M29 before G84.
- Subprograms use M98 and M99; macros with arguments use G65.
Quiz: Fanuc mill core codes
Mill and lathe: what does this code do?
M05
Quiz: Fanuc lathe codes (system A)
Lathe: what does this code do?
G32
Frequently asked questions
- Why does my Fanuc read X10 as 0.01?
- Many Fanuc controls read an axis value without a decimal point in the smallest input unit, so X10 can mean 0.010 mm (or 0.0010 inch). Write X10. with the point. Calculator-style input, where X10 means 10, is a parameter setting, so check how your machine is set.
- What are G-code systems A, B and C on a Fanuc lathe?
- Three code tables for lathes, chosen by a parameter. System A, the most common, uses U and W for incremental moves, G90 as a turning cycle and G98/G99 for feed mode. Systems B and C bring G90/G91 back as absolute/incremental and renumber some cycles. Check which one your lathe uses before reading a program.
- What is Fanuc Macro B?
- Fanuc's custom macro language: variables such as #100, arithmetic, IF and WHILE, and G65 calls with arguments. It is an option on many controls and is how probing cycles and family-of-parts programs are written.
G-Code Sprint is an educational practice tool only. It is not a CNC simulator, machine controller, safety manual, or replacement for instruction. Always follow your instructor, employer, machine manual, and shop procedures.