EasyManua.ls Logo

HEIDENHAIN TNC 620 Programming Station

HEIDENHAIN TNC 620 Programming Station
598 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Programming Qparameters | Programming examples
9.13 Programming examples
Example: Rounding a value
The INT function truncates the decimal places.
In order for the control to round correctly, rather than simply
truncating the decimal places, add the value 0.5 to a positive
number. For a negative number you must subtract 0.5.
The control uses the SGN function to detect whether a number is
positive or negative.
0 BEGIN PGM ROUND MM
1 FN 0: Q1 = +34.789
First number to be rounded
2 FN 0: Q2 = +34.345
Second number to be rounded
3 FN 0: Q3 = -34.432
Third number to be rounded
4 ;
5 Q11 = INT (Q1 + 0.5 * SGN Q1)
Add the value 0.5 to Q1, then truncate the decimal places
6 Q12 = INT (Q2 + 0.5 * SGN Q2)
Add the value 0.5 to Q2, then truncate the decimal places
7 Q13 = INT (Q3 + 0.5 * SGN Q3)
Subtract the value 0.5 from Q3, then truncate the decimal
places
8 END PGM ROUND MM
9
HEIDENHAIN | TNC620 | Klartext Programming User's Manual | 01/2022
351

Table of Contents

Related product manuals