mental degrees compared with the final angle

 mental degrees compared with the final angle, such as the 360 sed in the ex am ple:


O8009 (SINE CURVE MACRO)


#25 = 0


Set initial counter for degrees increment


WHILE [#25 LE 3600]


Loop for each linear segment until 360 degrees are machined


#26 = #1 * SIN[#25]


Calculate current Y-location


G90 G01 X#25 Y#26 F#9


Make a linear motion to the calculated XY location


#25 = #25+#4


Increase the counter by specified increment


END1


End of loop


M99


End of macro


%


If re quired, the start and fi nal an gles can be also in put as vari ables, if only a por tion of the sine


curve is needed The sine curve macro can be very eas ily changed into a co sine curve macro, by


shift ing the sine curve 90 to the left, or mov ing the Y-axis 90 to the right


Copyright 2005, Industrial Press Inc, New York, NY –


FANUC CNC Custom Macros


186


Chapter 13


Clearing Common Variables


One very use ful and prac ti cal ex am ple of a sim ple WHILE loop is the de vel op ment of a macro


that can be stored in the con trol mem ory per ma nently, to be used by notching machine any pro gram or from MDI


This macro clears the 500+ se ries of com mon vari ables, which can only be cleared by us ing


macro func tions The CNC op er a tor may clear all the vari ables at the con trol, in MDI mode, one


by one Much better so lu tion is to have a pro gram handy that cov ers all vari angle shearing machine ables in the range, and


sets them to the null (#0) state in di vid u ally, by a macro loop:


O8010 (CLEAR 500+ VARIABLES – INDIVIDUALLY ONE BY ONE)


#500 = #0


Common variable #500 cleared (set to null)


#501 = #0


Common variable #501 cleared (set to null)


#502 = #0


Common variable #502 cleared (set to null)


#503 = #0


Common variable #503 cleared (set to null)


#999 CNC Angle Line = #0


Common variable #999 cleared (set to null)


Such a pro gram can be quite long and will take un nec es sary mem ory space Using a loop, the


pro gram will be short ened sig nif i cantly and be more pro fes sional as well:


O8011 (CLEAR 500+ VARIABLES – BY A MACRO LOOP)

No Comments

rssComments RSS   transmitTrackBack Identifier URI

No comments. Be the first.

addLeave a comment