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
| Symptom | Likely Cause | What to Check |
|---|---|---|
| Tool goes wrong direction | G90/G91 distance mode | Is absolute or incremental active? |
| Dimensions off by 25.4× | Units mismatch | G20 (inch) vs G21 (metric) |
| Hole at wrong position | Work offset wrong | Is G54 X/Y correct? Accidentally on G55? |
| Arc is lopsided or wrong | I/J center offset error | I/J are from start point, not origin |
| Cycle drills extra holes | Missing G80 | Was the cycle cancelled after the pattern? |
| Tool crashes at cut depth | No Z retract before XY move | Was G00 Z50 before any XY move? |
| Tool cuts at wrong diameter | X treated as radius on lathe | X is diameter; radial depth = (X1-X2)/2 |
| Dimension off by tool radius | Cutter comp not active | Is G41/G42 on? Is D offset correct? |
| Spindle wrong direction | M03/M04 reversed | Check the S line and M03/M04 |
| Feed too fast/slow | G94 vs G95 mode | F in mm/min vs mm/rev |
Diagnosis Procedure
- Read the alarm — the alarm number and message tell you what the controller thinks is wrong. Do not clear it before reading it.
- 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?
- Verify on paper — trace the program from the start. Where should the tool be at each line? Compare to where it actually is.
- Make one change — fix one thing, then run again. Do not change three lines at once.
- Observe — use single-block mode and dry run to watch the corrected motion before full cut.
Example
Scenario: A hole appears at X50 when the program says X30. Systematic diagnosis:
- 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."
- Is G54 correct? Check the work offset display. If G54 X is set to 20, then X30 in the program lands at physical X50.
- Is the machine accidentally on G55? Check which work offset is active. If G55 has a different X origin, all positions shift.
- 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
- Guessing and re-running — change one thing at a time. Multiple changes at once make it impossible to know what fixed it.
- Ignoring the alarm text — the alarm number usually points directly to the problem. Read it before clearing.
- Changing the program instead of the offset — if the program says X30 and the hole is at X50, fix G54, not the program.
- Running full speed for diagnosis — use single-block, dry run, and feed override at 25% when testing.
- Forgetting to check which program is loaded — O1001 and O1011 can be confused at a glance.
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.