Haas · MTConnect

How to Set Up Part Counts on a Haas Next Gen Control

Make the machine count real parts, even when one cycle makes four of them, then let Spall turn that count into production and quality numbers you can trust.

~10 min · Last reviewed August 12, 2026

A Haas counts a part every time a program ends at M30. That works fine when one cycle equals one part. The moment you run a fixture with four parts, or a bar-fed lathe dropping a dozen per cycle, the machine undercounts and every production report built on it is wrong. This guide sets the counters up properly, shows the two floor counters and how to use them, and gives you a clean macro for counting multiple parts per cycle.

How the Haas counts, out of the box

Every time a program reaches M30 (program end), the control bumps two separate part counters: M30 Counter #1 and M30 Counter #2. You’ll find them under Current Commands > Timers And Counters.

Why two? So you can run them for different jobs. A common setup is to use one as a resettable shift or job counter and leave the other as a running lifetime total you never reset.

CURRENT COMMANDS HAAS • NEXT GEN CONTROL Devices Timers And Counters Macro TIMERS This Cycle0:00:41 Previous Cycle0:00:58 COUNTERS M30 Counter #11462 M30 Counter #247 Loops Remaining0 Lifetime total (never reset) Shift / job counter (ORIGIN to zero)
Current Commands > Timers And Counters. The two M30 counters live here. Highlight one and press ORIGIN to reset it to zero.

To reset a counter: cursor to the counter you want to clear and press ORIGIN. That zeroes just that value, so you can wipe the shift counter each morning while the lifetime total keeps climbing.

Looping programs (M99) If your program loops on M99 instead of ending on M30, turn on Setting 118 (M99 Bumps M30 Cntrs) so each loop still counts. One catch worth knowing: M99 only bumps the counter from a main program, not from inside a subprogram.

Counting multiple parts per cycle

Here is the part most shops get wrong. If one program cycle makes four parts but ends on a single M30, the counter goes up by one, not four. Your machine says 100 when the floor made 400. Every downstream number inherits that error.

The fix takes one line of code. The two M30 counters are stored in system macro variables you can write to directly:

Macro variableWhat it holds
#3901M30 Counter #1
#3902M30 Counter #2

Because M30 already adds one on its own, you add the remaining parts just before it. For a fixture of four parts, add three:

( ... end of your program ... )
#3901 = #3901 + 3   ( fixture of 4: add the other 3 )
#3902 = #3902 + 3   ( keep both counters in step )
M30                 ( M30 adds the 4th, counter moves by 4 )

The math is always parts-per-cycle minus one, because M30 supplies the last one. Two parts, add 1. Ten parts, add 9.

When the count changes cycle to cycle

On a bar-fed lathe, the number of parts per cycle can vary. Drive it from a variable instead of a hard number. Say #100 holds how many good parts this cycle made:

#3901 = #3901 + [#100 - 1]   ( add this cycle's parts, minus M30's one )
#3902 = #3902 + [#100 - 1]
M30
PROGRAM O01234 (4-UP FIXTURE) N120G00 G53 Z0. ; N125M09 ; N130( --- part counting --- ) N135#3901 = #3901 + 3 ; N140#3902 = #3902 + 3 ; N145M30 ; % Add these two lines right before M30. M30 supplies the 4th count itself.
The two macro lines added ahead of M30 in a four-up fixture program. On the NGC, edit and save the program as usual.

Always test one cycle After you add the macro, run a single cycle in a safe condition and watch M30 Counter #1 on the Timers And Counters page. It should jump by your full part count, four, not one. Then confirm the same number lands in Spall. Changing how a machine counts is exactly the kind of thing worth proving once before you trust the report.

How the count reaches Spall

Spall reads the machine’s part count over MTConnect, on the same connection you set up in the MTConnect guide. The MTConnect PartCount item reflects the machine’s M30 counter, so once the macro is counting correctly on the control, the corrected number flows straight through, and there’s nothing extra to configure on the Spall side. No separate wiring, no sensor on the fixture.

M30 Counter +4 / cycle MTConnect Spall reads PartCount Production target vs actual Quality good vs total
Fix the count on the machine once, and both the production and quality views in Spall inherit the correct number.

What Spall does with the count

Production. Spall turns the running count into pieces-per-shift and pieces-per-job against target, updating as the machine works. With the multi-part macro in place, the numbers finally match what shipped.

Quality. Pair the total count with scrap and reject tagging, and Spall separates good parts from total parts. That split feeds the Quality side of OEE instead of pretending every part was a keeper.

Performance. Count plus runtime gives a true per-part cycle time. When it creeps, Spall flags it before it eats a shift of capacity unnoticed.

OEE and dollars. Availability, performance, and quality combine into OEE, with each loss ranked in dollars so the biggest recovery is obvious, not buried in a spreadsheet.

Quick recap

  • M30 bumps Counter #1 and #2
  • View or reset under Timers And Counters
  • ORIGIN zeroes a counter
  • Multi-part: add (N minus 1) to #3901 / #3902 before M30
  • M99 loops need Setting 118 on
  • Test one cycle, confirm in Spall

Get the count right on the machine and everything above it gets accurate. That is the whole point, a number the floor believes.

Related guides

From the Help Center

$200/machine/mo · pilots from $4,500 · hardware included

See full pricing →

See your Haas machines live

30 days, hardware included, line pilot $4,500 or plant pilot $8,500, fully credited when you expand.