NewsCNCnetPDMAbout usSupport
  

READ PART COUNTERS | HEIDENHAIN

For any kind of performance-, OEE- or cycle-related analysis of machine data information about the number of produced workpieces is required. For machines equipped with Heidenhain TNC and iTNC controllers CNCnetPDM enables to automatically acquire part counter data without any user action required.

TECHNICAL BACKGROUND | ACQUIRE PART COUNTS | READ COUNTER DATA

Heidenhain part counter output (TNC 640)

FIG 1:    Part counter output (Heidenhain TNC 640)

TECHNICAL BACKGROUND

Heidenhain controllers have the ability to display and store workpiece counters. Storage is performed by the machine’s Programmable Logic Controller (PLC). For legacy TNC 426, 430 and iTNC 530 devices PLC Word Address 20 is used. Older TNC 320 -> TNC 640 devices may use PLC Word Address 10.

Newer controllers (TNC 320 -> TNC 7) use the concept of symbolic PLC address names. Means in practice that the same symbolic name for workpiece counter e.g. DG_PRODUCED_WORKPIECES points to different numeric PLC addresses on every machine.

Heidenhain PLC workpiece counter (TNC 640)

FIG 2:    Heidenhain PLC workpiece counter (old TNC 640)

ACQUIRE PART COUNTS

For newer controllers (TNC 320 -> TNC 7) you can use the following small NC program to increase the respective PLC address by 1:

0  BEGIN PGM COUNTPART MM 
1  FUNCTION COUNT INC ;Increase workpiece counter by 1
3  END PGM COUNTPART MM 
FIG 3:    Heidenhain part counter NC Program (TNC 640)

By using an NC program you can also directly write to a specific PLC address. To do so you can utilize an unused Q-Parameter that is not reset automatically, preferably between Q20 and Q99. The following example uses Q48. Write a small utility program, here COUNTPART, that maintains parameter Q48 and updates the respective PLC Address value.

  • Note: Please select only one version of line 2 according to your controller type.
0  BEGIN PGM COUNTPART MM 
1  FN 1: Q48 =+Q48 + +1 ;Increase Q48 by 1
2  FN 17: SYSWRITE ID 2000 NR70 IDX20 =+Q48 ; Write Q48 to PLC Workpiece Counter W20 iTNC 530
2  FN 17: SYSWRITE ID 2000 NR70 IDX10 =+Q48 ; Write Q48 to PLC Workpiece Counter W10 TNC 640
3  END PGM COUNTPART MM 
FIG 4:    Heidenhain part counter NC Program

count parts you simply have to add one line to every NC Program before its end that calls the above program e.g.

...
10  CALL PGM COUNTPART
11  END PGM FELGE_MILL MM
FIG 5:    Call Heidenhain part counter NC Program

READ COUNTER DATA

Reading of part counts with CNCnetPDM can be controlled by using the INI file of the machine which is automatically created for every connected device e.g. heidenhain_1000.ini for machine number 1000.

For counting workpieces section [1] of this file is used. To activate counting edit the file with a text editor, set Command = plcword, Active = 1 and Input parameter 1 to 10 or 20 for TNC 426, 430 and iTNC 530. Also make sure that CollectCounters = 1 is set in CNCnetPDM.ini.

[1]
Active = 1
Name = PARTC
Comment = Workpiece counter (iTNC 530)
Command = plcword
Input parameter 1 = 20
; Input parameter 1 = 10
Input parameter 2 = 1
Output item = 
Output section = 0
FIG 6:    Activate acquisition of Heidenhain part counters (iTNC 530)

For controllers that use symbolic PLC address names set Command = plcsymname, Active = 1 and Input parameter 1 to STG_WORKPIECE_COUNTER[0].DG_PRODUCED_WORKPIECES. Please make sure that the correct symbolic name definitions for your machine are extracted and loaded by CNCnetPDM (entry: Symbolic PLC Address Names).

[1]
Active = 1
Name = PARTC
Comment = Workpiece counter (TNC 640)
Command = plcsymname
Input parameter 1 = STG_WORKPIECE_COUNTER[0].DG_PRODUCED_WORKPIECES
Input parameter 2 = 1
Output item = 
Output section = 0
FIG 7:    Activate acquisition of Heidenhain part counters (TNC 320 -> TNC 7)

For testing you can also use the Heidenhain PLC utility program and query the respective addresses.

Privacy notice

This website uses cookies. By continuing to use it you agree to our privacy policy. 

https://www.inventcom.net/support/heidenhain/read-part-counters

Support | Heidenhain | Overview

For machines with Heidenhain TNC/iTNC controllers CNCnetPDM enables you to acquire and monitor machine-, process-, part-counter and quality-data and... [read more]
Support | Heidenhain | Overview

Support | Heidenhain | Release Notes

(9/3/2025) On Wednesday September 3 rd we released a new version of our popular IIoT adapter for Heidenhain controllers that supports devices from legacy TNC 426 up to the newest... [read more]
Support | Heidenhain | Release Notes

Support | Heidenhain | TNC Machine Data

For machines with Heidenhain TNC and iTNC controllers CNCnetPDM enables to acquire and monitor machine-, process- and quality-data in near real time. Seamless integration of the... [read more]
Support | Heidenhain | TNC Machine Data

Support | Heidenhain | Machine Monitoring

This highly configurable Heidenhain IIoT adapter for CNCnetPDM enables you to monitor machine-, process- and quality data from machines with Heidenhain controllers from TNC 426... [read more]
Support | Heidenhain | Machine Monitoring

Support | Heidenhain | Read TNC PLC Data

For machines with Heidenhain TNC and iTNC controllers this program enables to read and output PLC (Programmable Logic Controller) data from an external PC connected to the... [read more]
Support | Heidenhain | Read TNC PLC Data

Support | Heidenhain | Write TNC PLC Data

This utility program for machines with Heidenhain TNC and iTNC controllers allows writing and reading of PLC data and machine parameters from an external PC connected to the... [read more]
Support | Heidenhain | Write TNC PLC Data

Support | Heidenhain | DNC Option 18

For newer Heidenhain machine controllers ‘DNC Option 18’ can be purchased optionally . Without it most of the high level language commands to communicate with the... [read more]
Support | Heidenhain | DNC Option 18

Support | Heidenhain | Secure Communication

For machines with newer Heidenhain controllers (from TNC 320 up to TNC 7) Heidenhain supports and may require secure shell (SSH) communication between remote PCs and the device.... [read more]
Support | Heidenhain | Secure Communication

Support | Heidenhain | Symbolic PLC Names

For controllers starting with TNC 320 up to TNC 7 Heidenhain uses the concept of access to Programmable Logic Controller (PLC) addresses by  symbolic names . As the same... [read more]
Support | Heidenhain | Symbolic PLC Names
Modified: 2025-09-03