Skip to main content

FOCAS Part Counting Methods

Part counting is one of the most important FOCAS setup steps, and the right method depends on how the machine's programs end. If counts are already wrong, start with Part Counting troubleshooting.

Part Counting Methods​

Accurate part counting is critical for production tracking. FANUC machines support several methods.

Validating your part count after setup

Once part counting is configured, use the Connectivity Validation Guide to confirm it is working correctly — including how to identify bad counts on the Timeline before they affect production reporting.

Standard Cycle (M30/M02)​

For manually loaded parts with programs ending in M30 or M02:

The machine should count automatically when the program reaches M30 or M02. However, some machine tool builders use custom M-codes.

Step 1: Check Current Configuration

  1. Press SYSTEM hard key → Parameters
  2. Navigate to parameter 6700
  3. Look at bit 0 (PCM - Part Count Method):
    • 6700#0 = 0: Count on M02, M30, OR M-code in parameter 6710
    • 6700#0 = 1: Count ONLY on M-code in parameter 6710
  4. Check parameter 6710: Shows which M-code is used to count

Step 2: Choose Configuration

Recommended: Set 6700#0 = 0 (allows M02, M30, or custom M-code)

Step 3: Verify in MachineMetrics

  1. Configure part count data mapping
  2. Run test cycle on machine
  3. Wait 10-30 seconds for data sync
  4. Check the Timeline and/or Diagnostics view to watch for value changes
  5. Verify count increments in MachineMetrics

Looping Cycle (M99)​

For programs that loop (robot loading, pallet changers, automation):

Programs ending in M99 don't typically reach M30, so they won't count automatically.

Solution 1: Use Machine Tool Builder M-Code

  • Add the MTB's custom part count M-code before M99
  • Example: If 6710 = 56, add M56 before M99

Solution 2: Use Macro Variable #3901

  • Add #3901=#3901+1 before M99
  • This increments the system part counter
  • Requires Macro B option enabled

Where to Add:

... (program code)
M92 (MTB M-code method)
or
#3901=#3901+1 (Macro method)
M99 (loop back)

Here's an example program using the macro increment method on a FANUC Series 0i-MODEL D:

FANUC Series 0i-MODEL D EDIT mode — program O1000 containing #3901=#3901+1 instruction (highlighted) followed by M99; PARTS COUNT shows 11 in the status header

You can verify the increment is working by checking PARAMETER → TIMER/PART COUNT on the control:

FANUC 0i-D PARAMETER screen — TIMER/PART COUNT section showing param 06710 COUNT UP M-CODE = 92, param 06711 PARTS COUNT = 11, param 06712 PARTS TOTAL = 11

To test without running a full program cycle, use MDI mode and enter the macro increment directly:

FANUC 0i-D MDI mode — PROGRAM(MDI) buffer showing #3901=#3901+1 entered for a quick manual test of the part count macro

Custom M-Code Configuration​

To change which M-code counts parts:

⚠️ Warning: Only proceed if you have permission and parameter write access enabled.

Step 1: Enable Parameter Write

Step 2: Modify Parameters

  1. Press SYSTEM → Parameters
  2. Navigate to 6700
  3. Change bit 0 (PCM):
    • Set to 0 for M02/M30/Custom
    • Set to 1 for Custom only
  4. Navigate to 6710
  5. Enter desired M-code number (e.g., 92 for M92)
  6. Important: Choose an M-code NOT used by machine functions
  7. Avoid M98 (subprogram call) and M99 (loop)

Step 3: Reboot Machine

  • Power cycle for parameter changes to take effect

Step 4: Test

  1. Put machine in MDI mode
  2. Set feed/rapid overrides to zero
  3. Enter part count command (M30, custom M-code, or #3901=#3901+1)
  4. Press cycle start
  5. Check that count in parameter 6711 increments

Before Changing: Always check with your machine manufacturer or FANUC to ensure the M-code isn't already in use by another function.

Testing Part Count​

Quick Test Procedure:

  1. Set Machine to MDI Mode

    • Select MDI on mode selector
  2. Safety First

    • Set feed override to 0%
    • Set rapid override to 0%
    • This prevents any motion
  3. Clear MDI Buffer

    • Clear any existing MDI commands
  4. Enter Count Command

    • Type your count command:
      • M30 (standard)
      • M92 (or your custom M-code)
      • #3901=#3901+1 (macro method)
  5. Execute

    • Press CYCLE START
  6. Verify Count

    • Check system part counter (usually displayed on main screen)
    • Or check parameter 6711 (stores part count value)
    • Count should increment by 1
  7. Verify in MachineMetrics

    • Wait 10-30 seconds for data sync
    • Check the Timeline and/or Diagnostics view to watch for value changes
    • Check machine view in MachineMetrics
    • Part count should have incremented