Skip to main content

Haas Macro and System Variables

Macro variable access depends on your control generation

Newer generations of Haas NGC software output macro variables directly through the MTConnect adapter as MacroRange arrays — no secondary Haas Serial adapter is needed. See Macro Variable Collection Methods by Control Generation below to determine which method applies to your machine.

The Haas Serial adapter + macros JSON configuration is required when:

  • Your NGC control does not output MacroRange data via MTConnect (older NGC software generations)
  • You need a specific system variable that is not included in the MacroRange blocks (e.g. #3027 spindle RPM, #3901 M30 count)

If Setting 143 is not set to 4001, the Haas Serial adapter will not connect and macro variables will not be readable via that method.

Haas machines support reading macro and system variables via the Serial (DPRNT/MDC) connection. This is useful for accessing data not available via MTConnect, such as specific timers, counters, or custom machine settings.

Available Variable Types​

Haas machines provide hundreds of macro and system variables. Below is a comprehensive reference of available system and macro variables that can be read from Haas NGC controllers.

Complete Haas System & Macro Variables Reference​

NGC VariableLegacy VariableUsage
#1-#33#1-#33Macro call arguments
#10000-#10149#100-#149General-purpose variables saved on power off
#10150-#10199#150-#199Probe values (if installed)
#10200-#10399N/AGeneral-purpose variables saved on power off
#10400-#10499N/AGeneral-purpose variables saved on power off
#10500-#10549#500-#549General-purpose variables saved on power off
#10550-#10599#550-#599Probe calibration data (if installed)
#10600-#10699#600-#699General-purpose variables saved on power off
#10700-#10799N/AGeneral-purpose variables saved on power off
#700-#749#700-#749Hidden variables for internal use only
#709#709Used for Fixture Clamp Input. Do not use for general purpose.
#10800-#10999#800-#999General-purpose variables saved on power off
#11000-#11063N/A64 discrete inputs (read only)
#1064-#1068#1064-#1068Maximum axis loads for X, Y, Z, A, and B axes
#1080-#1087#1080-#1087Raw analog to digital inputs (read only)
#1090-#1098#1090-#1098Filtered analog to digital inputs (read only)
#1098#1098Spindle load with Haas vector drive (read only)
#1264-#1268#1264-#1268Maximum axis loads for C, U, V, W, and T-axes
#1601-#1800#1601-#1800Number of flutes on tools #1 through 200
#1801-#2000#1801-#2000Maximum recorded vibrations of tools 1 through 200
#2001-#2200#2001-#2200Tool length offsets
#2201-#2400#2201-#2400Tool length wear
#2401-#2600#2401-#2600Tool diameter/radius offsets
#2601-#2800#2601-#2800Tool diameter/radius wear
#3000#3000Programmable alarm
#3001#3001Millisecond timer
#3002#3002Hour timer
#3003#3003Single block suppression
#3004#3004Override [FEED HOLD] control
#3006#3006Programmable stop with message
#3011#3011Year, month, day
#3012#3012Hour, minute, second
#3020#3020Power on timer (read only)
#3021#3021Cycle start timer
#3022#3022Feed timer
#3023#3023Present part timer (read only)
#3024#3024Last complete part timer (read only)
#3025#3025Previous part timer (read only)
#3026#3026Tool in spindle (read only)
#3027#3027Spindle RPM (read only)
#3028#3028Number of pallets loaded on receiver
#3030#3030Single block
#3032#3032Block delete
#3033#3033Opt stop
#3034N/ASafe Run (read only)
#3196#3196Cell safe timer
#3201-#3400#3201-#3400Actual diameter for tools 1 through 200
#3401-#3600#3401-#3600Programmable coolant positions for tools 1 through 200
#3901#3901M30 count 1
#3902#3902M30 count 2
#4001-#4021#4001-#4021Previous block G-code group codes
#4101-#4126#4101-#4126Previous block address codes
#5001-#5006#5001-#5006Previous block end position
#5021-#5026#5021-#5026Present machine coordinate position
#5041-#5046#5041-#5046Present work coordinate position
#5061-#5069#5061-#5069Present skip signal position -X, Y, Z, A, B, C, U, V, W
#5081-#5086#5081-#5086Present tool offset
#5201-#5206#5201-#5206G52 work offsets
#5221-#5226#5221-#5226G54 work offsets
#5241-#5246#5241-#5246G55 work offsets
#5261-#5266#5261-#5266G56 work offsets
#5281-#5286#5281-#5286G57 work offsets
#5301-#5306#5301-#5306G58 work offsets
#5321-#5326#5321-#5326G59 work offsets
#5401-#5500#5401-#5500Tool feed timers (seconds)
#5501-#5600#5501-#5600Total tool timers (seconds)
#5601-#5699#5601-#5699Tool life monitor limit
#5701-#5800#5701-#5800Tool life monitor counter
#5801-#5900#5801-#5900Tool load monitor maximum load sensed so far
#5901-#6000#5901-#6000Tool load monitor limit
#6001-#6999#6001-#6999Reserved. Do not use.
#6198#6198NGC/CF flag
#7001-#7006#7001-#7006G110 (G154 P1) additional work offsets
#7021-#7026#7021-#7026G111 (G154 P2) additional work offsets
#7041-#7386#7041-#7386G112-G129 (G154 P3-P20) additional work offsets
#7501-#7506#7501-#7506Pallet priority
#7601-#7606#7601-#7606Pallet status
#7701-#7706#7701-#7706Part program numbers assigned to pallets
#7801-#7806#7801-#7806Pallet usage count
#8500#8500Advanced Tool Management (ATM) group ID
#8501#8501ATM percent of available tool life of all tools in the group
#8502#8502ATM total available tool usage count in the group
#8503#8503ATM total available tool hole count in the group
#8504#8504ATM total available tool feed time (in seconds) in the group
#8505#8505ATM total available tool total time (in seconds) in the group
#8510#8510ATM next tool number to be used
#8511#8511ATM percent of available tool life of the next tool
#8512#8512ATM available usage count of the next tool
#8513#8513ATM available hole count of the next tool
#8514#8514ATM available feed time of the next tool (in seconds)
#8515#8515ATM available total time of the next tool (in seconds)
#8550#8550Individual tool ID
#8551#8551Number of flutes of tools
#8552#8552Maximum recorded vibrations
#8553#8553Tool length offsets
#8554#8554Tool length wear
#8555#8555Tool diameter offsets
#8556#8556Tool diameter wear
#8557#8557Actual diameter
#8558#8558Programmable coolant position
#8559#8559Tool feed timer (seconds)
#8560#8560Total tool timers (seconds)
#8561#8561Tool life monitor limit
#8562#8562Tool life monitor counter
#8563#8563Tool load monitor maximum load sensed so far
#8564#8564Tool load monitor limit
#9000#9000Thermal comp accumulator
#9000-#9015#9000-#9015Reserved (duplicate of axis thermal accumulator)
#9016#9016Thermal spindle comp accumulator
#9016-#9031#9016-#9031Reserved (duplicate of axis thermal accumulator from spindle)
#10000-#10999N/AGeneral purpose variables
#11000-#11255N/A256 discrete inputs (read only)
#12000-#12255N/ADiscrete outputs
#13000-#13063N/AFiltered analog to digital inputs (read only)
#13013N/ACoolant level
#14001-#14006N/AG110 (G154 P1) additional work offsets
#14021-#14026N/AG110 (G154 P2) additional work offsets
#14041-#14386N/AG110 (G154 P3-G154 P20) additional work offsets
#14401-#14406N/AG110 (G154 P21) additional work offsets
#14421-#15966N/AG110 (G154 P22-G154 P99) additional work offsets
#20000-#29999N/ASettings
#30000-#39999N/AParameters
#32014N/AMachine Serial Number
#50001-#50200N/ATool Type
#50201-#50400N/ATool material
#50401-#50600N/ATool Offset Point
#50601-#50800N/AEstimated RPM
#50801-#51000N/AEstimated Feedrate
#51001-#51200N/AOffset Pitch
#51201-#51400N/AActually VPS Estimated RPM
#51401-#51600N/AWork Material
#51601-#51800N/AVPS Feedrate
#51801-#52000N/AApproximate length
#52001-#52200N/AApproximate diameter
#52201-#52400N/AEdge Measure height
#52401-#52600N/ATool Tolerance
#52601-#52800N/AProbe Type

Bold entries indicate commonly used variables for production monitoring.

Note: Variable addresses for older Haas controllers can be found in the "Legacy Variable" column. NGC (Next Generation Control) variables are shown in the first column.

Configure Macro Variables in Adapter​

To read macro variables, add a macros section to your Haas Serial adapter configuration. Do not add this to the MTConnect adapter — it will not work there.

{
"adapter": {
"mdcEnabled": 1
},
"macros": {
"opt-stop": 3033,
"last-m-code": 4113,
"part-timer": 3023,
"spindle-rpm": 3027,
"coolant-level": 13013,
"g54-x-offset": 5221,
"tool-1-life": 5701
}
}

How to Configure:

  1. On the Haas NGC control, verify Setting 143 is set to 4001
    • If it is not, set it now — without this, the Haas Serial adapter cannot connect
  2. In MachineMetrics, go to Assets → Machines
  3. Select your Haas machine
  4. If you have not already added a Haas Serial adapter, click Add Secondary Adapter and select Haas Serial with connection address [MACHINE-IP]:4001
  5. Click on the Haas Serial adapter (not the MTConnect adapter)
  6. Add the JSON configuration above in the adapter settings JSON field
  7. Customize the macro names and variable numbers as needed
  8. Save changes

Macro Configuration Format:

  • Key (left side): Data item name that will appear in MachineMetrics (use lowercase with hyphens)
  • Value (right side): Haas macro variable number

Common Useful Variables:

{
"adapter": {
"mdcEnabled": 1
},
"macros": {
"opt-stop-enabled": 3033,
"block-delete-enabled": 3032,
"single-block-enabled": 3030,
"m30-count": 3901,
"part-timer-seconds": 3023,
"last-part-timer-seconds": 3024,
"current-tool": 3026,
"spindle-rpm-actual": 3027,
"power-on-hours": 3020,
"cycle-start-timer": 3021,
"feed-timer": 3022,
"coolant-level-percent": 13013
}
}

These macro variables will appear as data items in MachineMetrics alongside other machine data.

Tool Life Monitoring Example:

For tracking tool life counters and presets, use the tool life monitoring variables:

{
"adapter": {
"mdcEnabled": 1
},
"macros": {
"TLM_1_COUNT": 5701,
"TLM_1_PRESET": 5601,
"TLM_2_COUNT": 5702,
"TLM_2_PRESET": 5602,
"TLM_3_COUNT": 5703,
"TLM_3_PRESET": 5603,
"TLM_4_COUNT": 5704,
"TLM_4_PRESET": 5604,
"TLM_5_COUNT": 5705,
"TLM_5_PRESET": 5605
}
}

Variable Explanation:

  • #5601-#5699: Tool life monitor limit (preset/maximum)
  • #5701-#5800: Tool life monitor counter (current usage)

Example:

  • TLM_1_COUNT (Macro #5701) = Current count for Tool 1
  • TLM_1_PRESET (Macro #5601) = Preset limit for Tool 1

If COUNT = 150 and PRESET = 500:

  • Tool 1 is at 30% used (70% remaining)

Note: For detailed tool life monitoring setup and configuration, see the Tool Life Monitoring Guide.


Macro Variable Collection Methods by Control Generation​

The method used to collect macro variables from a Haas NGC control depends on the vintage of the NGC machine's software. There are two approaches:

  • Method 1 — Haas Serial Secondary Adapter (described above): Older NGC software versions expose macro variables individually via the Serial/MDC adapter. You request specific variables by number in the JSON configuration. This is the method described in the section above.
  • Method 2 — MTConnect MacroRange Arrays (newer NGC software): Newer NGC software versions output macro variables in bulk directly through the MTConnect adapter, as large comma-separated arrays. These appear in MachineMetrics Data Mapping as items named MacroRange1 through MacroRange6, each containing hundreds of values representing a contiguous block of macro variable addresses.

If you see MacroRange items in your Data Mapping tab, your machine uses Method 2.

[haas-macrorange-data-mapping.png placeholder]

Understanding MacroRange Layout​

Each MacroRange covers a contiguous block of macro variable addresses. The ranges follow this pattern, based on Haas NGC variable numbering (where legacy 3-digit variables like #151 are stored internally as #10151):

MacroRangeVariable Range (Legacy)Variable Range (NGC)Notes
MacroRange1#1–#33#1–#33Local/call arguments — typically NaN when no program is running
MacroRange2#100–#199#10100–#10199General purpose + probe values
MacroRange3#200–#399#10200–#10399General purpose
MacroRange4#400–#599#10400–#10599General purpose + probe calibration
MacroRange5#600–#799#10600–#10799General purpose
MacroRange6#800–#999#10800–#10999General purpose
note

The exact boundaries may vary between machines. If you are unsure which range contains a variable, pull http://[machine-ip]:8082/probe and inspect the MacroRange startIndex attributes in the XML response.

Finding the Index for a Specific Variable​

The index of a macro variable within its MacroRange is calculated as:

index = variable_number - range_start

Example: To find macro variable #531:

  • #531 falls in MacroRange4 (starts at 400)
  • Index = 531 − 400 = 131

You can verify by inspecting the live value string in Data Mapping — count to position 131 (0-based) in the comma-separated list to confirm the expected value is present.

Reading a MacroRange Variable in an Adapter Script​

Use pattern-match with a regex that skips the first N comma-separated values:

var531:
- source: MacroRange4
- pattern-match:
pattern: /^(?:[^,]*,){131}([^,]+)/
group: 1

The {131} skips 131 values (0-based) to land on index 131. Adjust the number and source MacroRange for any variable you need.


  • Next Gen Control — adding the secondary serial connection that carries these variables
  • Classic Control — Classic controls read them over the primary serial connection
  • DPRNT — the alternative, where the program prints the value instead