Defining counters with FUNCTION COUNT

Application

With the FUNCTION COUNT NC function, you control a counter from within the NC program. This counter allows you, for example, to define a target count of workpieces up to which the control repeats the NC program.

Description of function

The control takes the FUNCTION COUNT function into consideration during program run and in the simulation.

The control uses a separate counter each for program run and for the simulation.

The control shows the current counter reading and the defined target count of machining operations on the PGM tab of the Status workspace.

The PGM tab

The counter reading remains the same after a restart of the control.

Input

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

Change the following contents as needed:

  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions (e.g., with M91)
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

11 FUNCTION COUNT TARGET5

; Set the target count of the counter to 5

Insert NC function All functions FN FUNCTION COUNT

The NC function includes the following syntax elements:

Syntax element

Meaning

FUNCTION COUNT

Syntax initiator for the counter

INC, RESET, ADD, SET, TARGET or REPEAT

Define counting function

Counting functions

Counting functions

The FUNCTION COUNT NC function provides the following counter functions:

Syntax

Function

INC

Increase the counter by 1

RESET

Reset the counter

ADD

Increase the counter by a defined value

Number, text, or variable

Input: 0...9999

SET

Assign a defined value to the counter

Number, text, or variable

Input: 0...9999

TARGET

Define the target count to be reached

Number, text, or variable

Input: 0...9999

REPEAT

Repeat the NC program from the label if the defined target count has not been reached yet

Number, text, or variable

Notes

 
Notice
Caution: Data may be lost!
The control manages the same counter for the Program Run operating mode and for the MDI application. The counter applies to all programs. If you execute an NC program that resets the counter, any counter progress of another NC program will be deleted, if applicable.
  1. Please check prior to machining whether a counter is active.
  • On the PGM tab of the Status workspace you also find the Counter settings window, which allows you to define the counter.
  • When the control executes FUNCTION COUNT in the NC program, it overwrites the values defined in the Counter settings window.

  • The PGM tab

  • The machine manufacturer uses the optional machine parameter CfgNcCounter (no. 129100) to define whether you can edit the counter.
  • You can engrave the current counter reading with Cycle 225 ENGRAVING.
  • Cycle 225 ENGRAVING

  • You can save the current counter reading in a variable using the FN 18: SYSREAD ID920 NR1 function.
  • Read system data with FN 18: SYSREAD

  • Client applications can change the counter reading using OPC UA and the NC.RemoteOperator role (#56-61 / #3-02-1*).
  • OPC UA NC Server (#56-61 / #3-02-1*)

Example

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

Change the following contents as needed:

  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions (e.g., with M91)
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

11 FUNCTION COUNT RESET

; Reset counter value

12 FUNCTION COUNT TARGET10

; Define the target count of machining operations

13 LBL 11

; Set a jump label

* - ...

; Execute the machining operation

21 FUNCTION COUNT INC

; Increase the counter reading by 1

22 FUNCTION COUNT REPEAT LBL 11

; Repeat the machining operation until the target count has been reached