Flexible NC programming
1.5 Precision correction on comparison errors (TRUNC)
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
69
Examples
Example 1: Precision considerations
Program code Comments
N40 R1=61.01 R2=61.02 R3=0.01 ; Assignment of initial values
N41 IF ABS(R2-R1) > R3 GOTOF ERROR ; Jump would have been executed up
until now
N42 M30 ; End of program
N43 ERROR: SETAL(66000) ;
R1=61.01 R2=61.02 R3=0.01 ; Assignment of initial values
R11=TRUNC(R1*1000) R12=TRUNC(R2*1000)
R13=TRUNC(R3*1000)
; Accuracy correction
IF ABS(R12-R11) > R13 GOTOF ERROR ; Jump is no longer executed
M30 ; End of program
ERROR: SETAL(66000) ;
Example 2: Calculate and evaluate the quotient of both operands
Program code Comments
R1=61.01 R2=61.02 R3=0.01 ; Assignment of initial values
IF ABS((R2-R1)/R3)-1) > 10EX-5 GOTOF ERROR ; Jump is not executed
M30 ; End of program
ERROR: SETAL(66000) ;