For any kind of performance-, OEE- or cycle-related analysis of machine data information about the number of produced workpieces is necessary. For machines equipped with Heidenhain TNC and iTNC controllers CNCnetPDM enables to automatically acquire part counter data without any user action required at the machine.
Heidenhain controllers have the ability to display and store workpiece counters. Storage is performed by the machine’s Programmable Logic Controller (PLC). Legacy TNC 426, 430 and iTNC 530 devices output the value of PLC Word Address 20 at the operator panel. 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 may point to different numeric PLC addresses on every machine.
ACQUIRE PART COUNTS
For newer controllers (TNC 320 -> TNC 7) you should 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 write to a 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. If you want to directly write to the specific PLC address that is used to display the actual part counter value at the operator panel you can use FN 17 (SYSWRITE).
Note: FN 17 only works after input of code number 555343 [MOD]. This has to be repeated on restart of the controller!
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
3 FN 17: SYSWRITE ID 2000 NR70 IDX10 =+Q48 ; Write Q48 to PLC Workpiece Counter W10 (older TNC 640)
4 END PGM COUNTPART MM
FIG 4: Heidenhain part counter NC Program (FN 17)
To avoid this you can also use FN 19. This function writes to a predefined PLC address. For TNC 426 up to iTNC 530 PLC DWord Address 280 is used, TNC 320 up to TNC 7 use the symbolic PLC address NN_DG_FN19[0] (same as NN_DG_FN19_VALUE_1).
Note: FN 19 does not update the value shown at the operator panel.
Write a small utility program, here COUNTPART, that maintains parameter Q48 and updates the respective PLC Address value.
0 BEGIN PGM COUNTPART MM
1 FN 1: Q48=+Q48 + +0.0001 ; Increase Q48 by 0.0001 (FN 19 variant)
2 FN 19: PLC=+Q48 ; Writes Q48 to DWORD 280 or NN_DG_FN19_VALUE_1 = NN_DG_FN19[0]
3 END PGM COUNTPART MM
FIG 5: Heidenhain part counter NC Program (FN 19)
To count parts you simply have to add one line to every NC Program before its end that calls program COUNTPART e.g.
...
10 CALL PGM COUNTPART
11 END PGM FELGE_MILL MM
FIG 6: Call Heidenhain part counter NC Program COUNTPART
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 and set Active = 1
FN 17: Set Command = plcword.
FN 19: Set Command = plcdword
FN 17: For TNC 426, 430 and iTNC 530 set Input parameter 1 to 20, for older TNC 320 to TNC 640 controls set Input parameter 1 to 10.
FN 19: Set input parameter 1 to 280.
Make sure that CollectCounters = 1 is set in CNCnetPDM.ini.
Input parameter 1 to STG_WORKPIECE_COUNTER[0].DG_PRODUCED_WORKPIECES
If you use the FN 19 variant set Input parameter 1 to NN_DG_FN19_VALUE_1
Please make sure that the correct symbolic name definitions for your machine are extracted and loaded by CNCnetPDM (entry: Symbolic PLC Address Names).
FIG 8: Activate acquisition of Heidenhain part counters (newer TNC 320 -> TNC 7)
To avoid issues please use the Heidenhain PLC utility program to query the respective numeric or symbolic addresses and compare it with the part counter value shown at the operator panel (ST:x).
Privacy notice
This website uses cookies. By continuing to use it you agree to our privacy policy.