← Back to CNC Programming

Diagnosing Program Problems

When the machine does something unexpected, systematic diagnosis beats trial and error. This page covers common symptoms, where to look, and how to fix each category of programming error without compounding the problem.

Concept

Program problems fall into four categories: motion errors (tool goes where it should not), dimension errors (part size is wrong), alarm errors (machine stops with a fault), and surface errors (finish or tool condition is poor). Each category has a diagnostic path: read the alarm, check the modal state, verify coordinates on paper, then make one change and observe.

Why It Matters

The #1 debugging mistake is changing a random line and re-running. This compounds errors: you fix one symptom but break another, and you lose track of what actually caused the problem. Systematic diagnosis — read, check one thing at a time, change one variable — is the engineering habit that prevents crashes and scrap.

How It Works

Symptom → Cause → Check Table

SymptomLikely CauseWhat to Check
Tool goes wrong directionG90/G91 distance modeIs absolute or incremental active?
Dimensions off by 25.4×Units mismatchG20 (inch) vs G21 (metric)
Hole at wrong positionWork offset wrongIs G54 X/Y correct? Accidentally on G55?
Arc is lopsided or wrongI/J center offset errorI/J are from start point, not origin
Cycle drills extra holesMissing G80Was the cycle cancelled after the pattern?
Tool crashes at cut depthNo Z retract before XY moveWas G00 Z50 before any XY move?
Tool cuts at wrong diameterX treated as radius on latheX is diameter; radial depth = (X1-X2)/2
Dimension off by tool radiusCutter comp not activeIs G41/G42 on? Is D offset correct?
Spindle wrong directionM03/M04 reversedCheck the S line and M03/M04
Feed too fast/slowG94 vs G95 modeF in mm/min vs mm/rev

Diagnosis Procedure

  1. Read the alarm — the alarm number and message tell you what the controller thinks is wrong. Do not clear it before reading it.
  2. Check modal state — on the controller, display active G codes. Is G90 or G91 active? G20 or G21? G41 or G40? G80 or a cycle?
  3. Verify on paper — trace the program from the start. Where should the tool be at each line? Compare to where it actually is.
  4. Make one change — fix one thing, then run again. Do not change three lines at once.
  5. Observe — use single-block mode and dry run to watch the corrected motion before full cut.
Symptom Read Alarm Check State One Fix Observe Done
Systematic diagnosis: symptom → read alarm → check modal state → one fix → observe. Never change multiple lines at once.

Example

Scenario: A hole appears at X50 when the program says X30. Systematic diagnosis:

  1. Is G90 (absolute) active? Check the modal display. If G91 (incremental) is active, X30 means "move 30 mm from current position," not "go to X30."
  2. Is G54 correct? Check the work offset display. If G54 X is set to 20, then X30 in the program lands at physical X50.
  3. Is the machine accidentally on G55? Check which work offset is active. If G55 has a different X origin, all positions shift.
  4. Are you running the correct program? Check the O number on the controller display. Machine shops have dozens of similar programs.

Most likely: G54 X offset is off by 20 mm. Fix the offset — do not change the program. If you changed X30 to X10 to compensate, the program is now wrong for the next setup.

Common Mistakes

Practice

1. The part comes out 25.4× too small. What happened?

Ans

Units mismatch: the program uses mm (G21) but the machine is in inch mode (G20), or vice versa. 1 inch = 25.4 mm. Check the active units modal.

2. After drilling four holes, the next X/Y move makes an unexpected hole. Why?

Ans

Missing G80 after the hole pattern. The drilling cycle stayed modal, so the next X/Y position triggered another drill cycle. Add G80.

3. How do you verify which program is loaded on the controller?

Ans

Check the O number on the controller display. Machine shops have many programs with similar names; always confirm the O number before running.

4. An arc comes out lopsided. What is the most likely cause?

Ans

I/J center offset error. I/J are incremental from the arc start point, not absolute from G54. Check that I and J are the vector from start to center.