Basic arithmetic operations

With the D01 through D05 functions, you can calculate values within your NC program. If you want to calculate with variables, you need to assign an initial value to each variable by means of the D00 function.

The control provides the following functions:

Syntax

Meaning

D00

Assignment

Assign a value or the Undefined status

D01

Addition

Calculate and assign the sum of two values

D02

Subtraction

Calculate and assign the difference of two values.

D03

Multiplication

Calculate and assign the product of two values.

D04

Division

Calculate and assign the quotient of two values

Restriction: You cannot divide by 0

D05

Square root

Calculate and assign the square root of a number

Restriction: You cannot calculate a square root from a negative value

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.

N110 D00 Q5 P01 +60

; Assignment Q5 = 60

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.

N110 D01 Q1 P01 –Q2 P02 –5

; Addition Q1 = –Q2+(–5)

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.

N110 D02 Q1 P01 +10 P02 +5

; Subtraction Q1 = +10–(+5)

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.

N110 D03 Q2 P01 +3 P02 +3

; Multiplication Q2 = 3*3

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.

N110 D04 Q4 P01 +8 P02 +Q2

; Division Q4 = 8/Q2

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.

N110 D05 Q20 P01 4

; Square root Q20 =4

D corresponds to the FN Klartext syntax.

The numbers of the ISO syntax correspond to the numbers of the Klartext syntax.

P01, P02 etc. are considered as placeholders (e.g., for arithmetic operators included in the Klartext syntax).

Basic arithmetic folder

 
Tip

HEIDENHAIN recommends direct formula input, as this allows you to program multiple arithmetic operations in one NC block.

Formulas in the NC program