A FANUC control counts a part each time the program ends at M02 or M30. That’s correct for one part per cycle. Run a fixture with four parts, or a bar job dropping a dozen per cycle, and the control counts one where the floor made four or twelve. Every production and quality number built on that count inherits the error. This guide shows how FANUC counts, the two clean ways to count multiple parts per cycle, and how the corrected number reaches Spall.
How a FANUC counts, out of the box
FANUC keeps its part counters in parameters you can see and set on the control. The important ones:
| Parameter | What it does |
|---|---|
6711 | PARTS COUNT, the running number of machined parts |
6712 | PARTS TOTAL, a lifetime total |
6713 | PARTS REQUIRED, the target for the job |
6710 | The M code that bumps the count |
6700#0 (PCM) | Counting mode bit. 0: count on M02 / M30 (or the M code in 6710). 1: count only on the M code in 6710. |
With 6700#0 (PCM) = 0, the control bumps PARTS COUNT by one every time it hits M02 or M30. That single “+1” is the whole problem when a cycle makes more than one part.
Counting multiple parts per cycle
The fix lives in the part program, using the FANUC system variable tied to the counter:
| System variable | What it holds |
|---|---|
#3901 | PARTS COUNT (same value as parameter 6711) |
#3902 | PARTS TOTAL (same value as parameter 6712) |
Prerequisite Writing to
#3901needs the Custom Macro (Macro B) option enabled on the control. It’s on the vast majority of machines. If your control can’t read or write#variables, that option is missing, your builder or FANUC can turn it on.
Method A: add the extra parts before M30
If you leave automatic counting on (PCM = 0), M30 already adds one. So you add the remaining parts just before it. For a fixture of four, add three:
( ... end of program ... )
#3901 = #3901 + 3 ( fixture of 4: add the other 3 )
M30 ( M30 adds the 4th, count moves by 4 )
The rule is parts-per-cycle minus one, because M30 supplies the last one. Simple, and it leaves the control’s default behavior alone.
Method B: take full control of the count
Cleaner when the count varies, or when you just want the arithmetic to read plainly. Turn off the automatic M30 bump by setting 6700#0 (PCM) = 1 and pointing parameter 6710 at an M code you never actually run. Now nothing counts on its own, and you add the exact number in the program:
( PCM = 1, so M30 no longer counts on its own )
#3901 = #3901 + 4 ( add exactly this cycle's parts )
M30
When the number changes cycle to cycle, drive it from a variable. Say #100 holds this cycle’s good parts:
#3901 = #3901 + #100 ( bar job: whatever ran this cycle )
M30
Always test one cycle After you change how the machine counts, run a single cycle in a safe condition and watch PARTS COUNT on the control. It should jump by your full part count, four, not one. Then confirm the same number shows in Spall. Proving it once beats trusting a report that’s off by 4x and nobody’s checked.
How the count reaches Spall
Spall reads PARTS COUNT (parameter 6711 / #3901) directly over FOCAS, on the same connection from the FOCAS setup guide. Fix the count on the control and the corrected number flows straight through, no extra sensor on the fixture, no separate wiring.
What Spall does with the count
Production. Spall turns PARTS 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. That split feeds the Quality side of OEE instead of assuming every part was a keeper.
Performance. An accurate 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, each loss ranked in dollars so the biggest recovery is obvious instead of buried in a spreadsheet.
Quick recap
- PARTS COUNT = param 6711 =
#3901 - Needs the Macro B option
- Method A: add (N minus 1) before M30
- Method B: PCM=1, then add exactly N
- Varies by cycle? Add
#100 - Test one cycle, confirm in Spall
Get the count right on the control and everything above it gets accurate. That’s the whole point, a number the floor believes.