Programming variables
The control provides the following options for programming variables in ISO programs:
Function group | Further information |
---|---|
Basic arithmetic operations | |
Trigonometric functions | |
Circle calculations | |
Jump commands | |
Special functions | |
String functions | Corresponds to the Klartext syntax |
Counters | Corresponds to the Klartext syntax |
Calculations using formulas | Corresponds to the Klartext syntax |
Function for the definition of complex contours |
The control distinguishes between the Q, QL, QR, and QS variable types (parameter types).
Not all NC functions for programming variables are available in ISO programs (e.g., accessing tables with SQL statements).
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 |
N110 D00 Q5 P01 +60 | ; Assignment Q5 = 60 |
N110 D01 Q1 P01 –Q2 P02 –5 | ; Addition Q1 = –Q2+(–5) |
N110 D02 Q1 P01 +10 P02 +5 | ; Subtraction Q1 = +10–(+5) |
N110 D03 Q2 P01 +3 P02 +3 | ; Multiplication Q2 = 3*3 |
N110 D04 Q4 P01 +8 P02 +Q2 | ; Division Q4 = 8/Q2 |
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).
HEIDENHAIN recommends direct formula input, as this allows you to program multiple arithmetic operations in one NC block.
Trigonometric functions
You can use these functions to calculate trigonometric functions for purposes such as programming variable triangular contours.
The control provides the following functions:
Syntax | Meaning |
---|---|
D06 | Sine Calculate and assign the sine of an angle in degrees |
D07 | Cosine Calculate and assign the cosine of an angle in degrees |
D08 | Root of the sum of squares Calculate and assign the length based on two values (e.g., to calculate the third side of a triangle). |
D13 | Angle Calculate and assign the angle from the opposite side and the adjacent side using arctan or from the sine and cosine of the angle (0 < angle < 360°) |
N110 D06 Q20 P01 –Q5 | ; Sine, Q20 = sin(–Q5) |
N110 D07 Q21 P01 –Q5 | ; Cosine, Q21 = cos(–Q5) |
N110 D08 Q10 P01 +5 P02 +4 | ; Root of the sum of squares, Q10 = √(52+42) |
N110 D13 Q20 P01 +10 P02 –Q1 | ; Angle, Q20 = arctan(25/–Q1) |
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).
The Trigonometric functions folder
HEIDENHAIN recommends direct formula input, as this allows you to program multiple arithmetic operations in one NC block.
Circle calculation
These functions allow you to calculate the center of a circle and the radius of the circle based on the coordinates of three or four points on the circle (e.g., the position and size of a circle segment).
The control provides the following functions:
Syntax | Meaning |
---|---|
D23 | Circle data from three points on the circle The control saves the determined values in three successive Q parameters so that you only need to program the number of the first variable. |
D24 | Circle data from four points on the circle The control saves the determined values in three successive Q parameters so that you only need to program the number of the first variable. |
N110 D23 Q20 P01 Q30 | ; Circle data from three points on the circle |
N110 D24 Q20 P01 Q30 | ; Circle data from four points on the circle |
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).
Jump commands
In if-then decisions, the control compares a variable or fixed value with another variable or fixed value. If the condition is fulfilled, the control jumps to the label programmed for the condition.
If the condition is not fulfilled, the control continues with the next NC block.
The control provides the following functions:
Syntax | Meaning |
---|---|
D09 | Jump if equal If both values are equal, the control jumps to the defined label. |
Jump if undefined If the variable is undefined, the control jumps to the defined label. | |
Jump if defined If the variable is defined, the control jumps to the defined label. | |
D10 | Jump if not equal If both values are not equal, the control jumps to the defined label. |
D11 | Jump if greater than If the first value is greater than the second one, the control jumps to the defined label. |
D12 | Jump if less than If the first value is less than the second one, the control jumps to the defined label. |
N110 D09 P01 +Q1 P02 +Q3 P03 “LBL“ | ; Jump if equal |
N110 D09 P01 +Q1 IS UNDEFINED P03 “LBL“ | ; Jump if undefined |
N110 D09 P01 +Q1 IS DEFINED P03 “LBL“ | ; Jump if defined |
N110 D10 P01 +10 P02 -Q5 P03 10 | ; Jump if not equal |
N110 D11 P01 +Q1 P02 +10 P03 QS5 | ; Jump if greater than |
N110 D12 P01 +Q5 P02 +0 P03 “LBL“ | ; Jump if less than |
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).
Functions for freely definable tables
You can open any free definable table and subsequently write to it or read from it.
The control provides the following functions:
Syntax | Meaning |
---|---|
D26 | Open a freely definable table |
D27 | Write to a freely definable table |
D28 | Read from a freely definable table |
N110 D26 TNC:\DIR1\TAB1.TAB | ; Open a freely definable table |
N110 Q5 = 3.75 | ; Define the value for the Radius column |
N120 Q6 = -5 | ; Define the value for the Depth column |
N130 Q7 = 7,5 | ; Define the value for the D column |
N140 D27 P01 5/“Radius,Depth,D“ = Q5 | ; Write defined values to the table |
N110 D28 Q10 = 6/“X,Y,D“* | ; Read numerical values from the X, Y, and D columns |
N120 D28 QS1 = 6/“DOC“* | ; Read the alphanumeric value from the DOC column |
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).
Special functions
The control provides the following functions:
Syntax | Meaning |
---|---|
D14 | Output error messages |
D16 | Output formatted texts |
D18 | |
D19 | Transfer values to the PLC |
D20 | Synchronize NC and PLC |
D29 | Transfer values to the PLC |
D37 | Create user-defined cycles |
D38 | Send information from the NC program |
N110 D14 P01 1000 | ; Output error message no. 1000 |
N110 D16 P01 F-PRINT TNC:\mask.a / TNC: \Prot1.txt | ; Display the output file with D16 on the control screen |
N110 D18 Q25 ID210 NR4 IDX3 | ; Save the active dimension factor of the Z axis in Q25 |
N110 D38 /"Q-Parameter Q1: %F Q23: %F" P02 +Q1 P02 +Q23 | ; Write the values of Q1 and Q23 to the log |
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).
- Only use the function in consultation after checking with HEIDENHAIN, the machine manufacturer, or the third-party provider.
- Comply with the documentation from HEIDENHAIN, the machine manufacturer, and third-party providers