PROGRAMMING
B–64124EN/01
15. CUSTOM MACRO
319
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 (See III–9.7).
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.
,
Brackets are used to change the order of operations. Brackets can be used
to a depth of five levels including the brackets used to enclose a function.
When a depth of five levels is exceeded, P/S alarm No. 118 occurs.
Example) #1=SIN [ [ [#2+#3] *#4 +#5] *#6] ;
to 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
D Bracket nesting