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

PROGRAMMING
16. CUSTOM MACRO
B–62764EN/01
382
The operations listed in Table 16.3(a) can be performed on variables. The
expression to the right of the operator can contain constants and/or
variables combined by a function or operator. Variables #j and #K in an
expression can be replaced with a constant. Variables on the left can also
be replaced with an expression.
Table 16.3(a) Arithmetic and logic operation
Function
Format Remarks
Definition #i=#j
Sum
Difference
Product
Quotient
#i=#j+#k;
#i=#j–#k;
#i=#j*#k;
#i=#j/#k;
Sine
Cosine
Tangent
Arctangent
#i=SIN[#j];
#i=COS[#j];
#i=TAN[#j];
#i=ATAN[#j]/[#k];
An angle is specified in de-
grees. 90 degrees and 30
minutes is represented as
90.5 degrees.
Square root
Absolute value
Rounding off
Rounding down
Rounding up
#i=SQRT[#j];
#i=ABS[#j];
#i=ROUND[#j];
#i=FIX[#j];
#i=FUP[#j];
OR
XOR
AND
#i=#j OR #k;
#i=#j XOR #k;
#i=#j AND #k;
A logical operation is per-
formed on binary numbers
bit by bit.
Conversion from BCD to BIN
Conversion from BIN to BCD
#i=BIN[#j];
#i=BCD[#j];
Used for signal exchange
to and from the PMC
The units of angles used with the SIN, COS, TAN, and ATAN functions
are degrees. For example, 90 degrees and 30 minutes is represented as
90.5 degrees.
After the ATAN function, specify the lengths of two sides separated by
a slash. A result is found where 0xresultt360.
Example :
When #1=ATAN[1]/[–1], the value of #1 is 135.0
S When the ROUND function is included in an arithmetic or logic
operation command, IF statement, or WHILE statement, the ROUND
function rounds off at the first decimal place.
Example:
When #1=ROUND[#2]; is executed where #2 holds 1.2345, the value
of variable #1 is 1.0.
S When the ROUND function is used in NC statement addresses, the
ROUND function rounds off the specified value according to the least