Hello Mouse,
As pointed out by Vancbiker, not all machines have a parts counter, as its MTB specific. However, the System Variables for:
1. Number of machined parts (completion number - #3901)
2. Number of required parts (target number - #3902)
are available.
If making your own Counter Routine, its generally important that that the Target Number and the Parts Machined are maintained when power to the control is cycled. This can be achieved by using a Common, Nonvolatile Macro Variable (=> #500). However, if you use these Variables, you need to be sure that they are not being used by other Macro Programs, such as proprietary MTB's Macros, or Tool/Part measuring Macro Programs. Accordingly, a safer option is to use the purpose supplied #3901 and #3902 System Variables.
You could create a Macro Programs for Parts Counting Increment, Parts Counting Reset and Parts Number Target Setting using a Custom "M" Code to call the Macro Programs. Accordingly, you would insert the M code for Parts Counting Increment at the appropriate place in you Part Program to increment the Counter.
Regards,
Bill