Haas codes
HaasSystemIntermediate15-30 minutes

504

Haas 504 - UNBALANCED BRACKETS IN EXPRESSION | Haas CNC Alarm

UNBALANCED BRACKETS IN EXPRESSION

This alarm is triggered by the Haas control when it detects mismatched or unbalanced square brackets in a macro expression during program execution. The control parser cannot properly evaluate the mathematical or logical expression because brackets are missing, extra, or incorrectly nested. The machine will halt program execution at the line containing the malformed expression until the error is corrected.

Safety

  • Tool change may fail

Common Causes

  • Missing opening or closing square bracket in a macro variable expression such as #[#100+5] written incorrectly as #[#100+5
  • Extra brackets added during manual program editing or conversational programming that create syntax errors in variable assignments
  • Nested bracket expressions with incorrect pairing such as #[[100]+#[200] where internal brackets do not match properly
  • Program created or edited on external software with bracket character corruption or incorrect ASCII codes transferred via RS-232 or USB
  • Typing errors when manually entering complex macro expressions at the control using variables and mathematical operations

Troubleshooting Steps

  1. 1Step 1: Note the program line number displayed with the alarm and navigate to that exact line in EDIT mode to examine the expression
  2. 2Step 2: Visually inspect all square brackets in the flagged expression and count opening versus closing brackets to identify missing or extra brackets
  3. 3Step 3: Simplify complex nested expressions by breaking them into multiple lines with intermediate variable assignments to isolate the malformed section
  4. 4Step 4: If program was transferred from external source, re-send the program using proven RS-232 settings (9600 baud, even parity, 7 data bits, 2 stop bits) or use USB with verified file integrity
  5. 5Step 5: Compare the expression syntax against the Haas Macro Programming manual examples to verify proper bracket usage and nesting rules
  6. 6Step 6: If alarm persists on verified correct syntax, backup programs, perform a control software reload, and contact Haas Automation for potential control board diagnostics

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.