CNC SUBROUTINES AND MACROS Machinery's Handbook, 31st Edition
1382
#19 = 800(SPINDLE SPEED DEFINED) #9 = 15.0(CUTTING FEEDRATE DEFINED) If a macro feature is available, variables can be defined and used in the main program directly, for example: #19 = 800 N4 G90 G54 G00 X24.0 Y13.5 S#19 M03 Many variations and applications are possible. Macro Functions.— The available macro functions can be divided into six groups: 1) ARITHMETIC functions 2) TRIGONOMETRIC functions 3) ROUNDING functions 4) MISCELLANEOUS functions 5) LOGICAL functions and operations 6) CONVERSION functions Macro Arithmetic Functions: There are four arithmetic functions: + Addition * Multiplication - Subtraction / Division Example: #1 = 3.5 3.5 Returned value of variable #1 is 3.5 #2 = 4.25 4.25 Returned value of variable #2 is 4.25 #3 = 2.0 + 5.0 7.0 Returned value of variable #3 is a sum of 2+5 #4 = #3 + 1 8.0 Add 1 to the result of variable #3 #5 = #2—0.8 3.45 Subtract 0.8 from the current value of variable #2 #6 = #1—#3 -3.5 Subtract contents of #3 from the contents of #1 #7 = #2 * 6 25.5 Multiply contents of #2 by 6 #8 = 7.0 / 8.0 0.875 Divide 7 by 8 as real numbers #9 = 7 / 8 0.875 Divide 7 by 8 as integer numbers Trigonometric Functions: The following trigonometric functions are generally avail able for macros: SIN Sine COS Cosine TAN Tangent ASIN arcsine ACOS arccosine ATAN arctangent All inputs for SIN, COS, and TAN are in degrees and the output of the inverse functions ATAN, ASIN and ACOS is also in degrees. Inverse functions are usually marked as tan –1 , sin –1 , and cos –1 on the calculator. Example: #1 = SIN[38] 0.6156615 Actual value must be in brackets #2 = 23.7 23.7 #3 = COS[#2] 0.9156626 Reference to a variable must be in brackets #4 = TAN[12.86] 0.2282959 The inverse trigonometric functions accept the length of two sides of a triangle, both enclosed in brackets, “[ ]”, and separated by the slash symbol, “/”, standing alone between them. The acceptable range is within 0 ≤ RESULT < 360: Example: #5 = ATAN[0.25]/[0.5] 26.5650512 Position of the slash symbol is important ASIN and ACOS functions are not available on all controls.
Copyright 2020, Industrial Press, Inc.
ebooks.industrialpress.com
Made with FlippingBook - Share PDF online