FANUC codes
FANUCProgram/G-codeIntermediate10-20 minutes

122

Fanuc Alarm 122 - Division by Zero

Macro Division Error

Macro execution alarm: Macro Division Error. An error occurred during custom macro program execution.

Root Cause Summary

FANUC Alarm 122 occurs when the custom macro nesting depth exceeds the system limit, typically 4 levels deep for most Fanuc controls. This happens when a macro program calls another macro, which calls another, and so on, exceeding the maximum allowable nesting level defined by the control's macro executor.

Safety

  • Math error

Causes and Fixes

  1. 1

    Review the active macro program structure and count the nesting levels. Check SYSTEM > CURRENT > PROGRAM to identify which O-number macro is currently executing when the alarm occurs.

  2. 2

    Examine all G65 macro calls and M98 subprogram calls within the macro program hierarchy. Map out the calling sequence to identify where nesting exceeds 4 levels deep.

  3. 3

    Restructure the macro program logic to reduce nesting depth. Combine multiple nested macros into single routines or use sequential calls instead of nested calls where possible.

    Backup the original macro programs before modifying. Test restructured macros in single block mode first.

  4. 4

    Verify parameter 6071 (macro nesting level limit) if available on your control series. On 30i/31i/32i systems, this parameter may allow adjustment of nesting depth, though standard limit remains 4 levels.

DIY Feasiblehigh confidence

Call a technician if:

  • ·Memory corruption persists after power cycle
  • ·Parameter changes required beyond standard settings
  • ·Hardware-related macro execution failures

Prevention

  • Limit macro nesting to maximum 3 levels
  • Use sequential macro calls instead of nested calls when possible
  • Implement proper error handling in custom macros
  • Regular backup of working macro programs

Common Mistakes

  • Modifying parameter 6050 without understanding implications
  • Not checking for recursive calls in macro logic
  • Ignoring macro variable cleanup between operations
  • Mixing M98 and G65 calls without considering total depth

Related Alarms

Seeing Multiple Alarms?

Seeing another alarm with this one? Enter the code.

Get machine-aware diagnosis

AxisMD logs alarms against your actual machines, tracks patterns, and gives AI context your manual doesn't have.

Start free

Was this guide helpful?

Always verify with your machine manual or a certified technician before performing service procedures.