FANUC Series 16/18/160/180-Model C Machining Center Operators Manual

PROGRAMMING
B–62764EN/01
16. CUSTOM MACRO
383
Example:
Creation of a drilling program that cuts according to the values of
variables #1 and #2, then returns to the original position
Suppose that the increment system is 1/1000 mm, variable #1 holds
1.2345, and variable #2 holds 2.3456. Then,
G00 G91 X–#1; Moves 1.235 mm.
G01 X–#2 F300;Moves 2.346 mm.
G00 X[#1+#2]; Since 1.2345 + 2.3456 = 3.5801, the travel distance
is 3.580, which does not return the tool to the
original position.
This difference comes from whether addition is performed before or
after rounding off. G00X–[ROUND[#1]+ROUND[#2]] must be
specified to return the tool to the original position.
With CNC, when the absolute value of the integer produced by an
operation on a number is greater than the absolute value of the original
number, such an operation is referred to as rounding up to an integer.
Conversely, when the absolute value of the integer produced by an
operation on a number is less than the absolute value of the original
number, such an operation is referred to as rounding down to an integer.
Be particularly careful when handling negative numbers.
Example:
Suppose that #1=1.2 and #2=–1.2.
When #3=FUP[#1] is executed, 2.0 is assigned to #3.
When #3=FIX[#1] is executed, 1.0 is assigned to #3.
When #3=FUP[#2] is executed, –2.0 is assigned to #3.
When #3=FIX[#2] is executed, –1.0 is assigned to #3.
When a function is specified in a program, the first two characters of the
function name can be used to specify the function.
Example:
ROUND RO
FIX FI
Functions
Operations such as multiplication and division (*, /, AND)
Operations such as addition and subtraction (+, –, OR, XOR)
Example) #1=#2+#3*SIN[#4];
and indicate the order of operations.
,
D Rounding up and down
to an integer
D Abbreviations of
arithmetic and logic
operation commands
D Priority of operations

Leave a Reply

Your email address will not be published. Required fields are marked *