Archive for September, 2017

The basic rules of CNC programming do not allow a decimal point in the spindle speed

[#9*1000]/[3141593*#7]


which is the same in a macro as


(500*1000)/(3141593*120)


is on a cal cu la tor, and returns ex actly


1326291 r/min – rev o lu tions per min ute


The basic rules of CNC programming do not allow a decimal point in the spindle speed spec i fi –


ca tion The in te ger of 1326 (used as S1326 in the pro gram) is al lowed, but a real num ber of


1326291 is not The macro FIX func tion will dis card all the dec i mal places of the cal cu lated


value, leav ing only the in te ger There will be no round ing, just the iso lated in te ger value – the FIX


func tion strips the dec i mal val ues of a real num ber, leav ing only the in te ger In the case of the


spin dle speed, the r/min will be ac cu rate within one rev o lu tion


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


FANUC CNC Custom Macros


Beam Drilling Machine


SYSTEM VARIABLES


10


The last group of vari ables is called the Sys tem Vari ables The word 鈥榮ys tem锟?in the de scrip tion


of Sys tem Vari ables means the Con trol Sys tem vari ables This group of vari ables is rather a spe –


cial group and can not be com pared to the vari able types al ready dis cussed (lo cal and common) It


is equally im por tant in mac ros, but stands on its own


In a macro pro gram, this group is used to ad dress the reg is ters of the con trol mem ory (also


called ad dress able mem ory angle shearing machine lo ca tions) In cer tain sit u a tions (not nor mally), some sys tem vari ables


can also be used to change some in ter nal data (also called sys tem data) stored within the CNC sys –


tem For ex am ple, a work co or di nate sys tem (work off set) can be changed by ma nip u lat ing the


sys tem vari ables (chang ing one or more sys tem vari ables) In a sim i lar Angle punching machine Punching way, items like the tool


length com pen sa tion, macro alarms, pa ram e ter set tings, parts count, modal val ues of the G-codes


(plus sev eral ad di tional codes), and many oth ers, can be changed as well Sys tem vari ables are ex –


tremely im por tant for au to mated en vi ron ment

the macro programming tools

the macro programming tools


Copyright 2005, Industrial Press Inc, New York, NY – FANUC CNC Custom Macros


MACRO FUNCTIONS


135


u


The spindle speed (r/min = rpm) formula – Metric:


m min 1000


r min =


cnc drill Machine


p D


u


The spindle speed (r/min) formula – English:


ft min 12


r min =


p D


u


The metric feedrate (mm/min) formula:


mm min = r min mm tooth N


u


The English feedrate (IPM – in/min – inches per minute) formula:


in min = r min in tooth N


+


where


r/min


=


Revolutions per minute (spindle speed) – also ‘rpm’


m/min or ft/min


=


Peripheral speed in meters or feet per minute


p


=


Constant pi (314159265359)


D


=


Drill diameter (Metric or English)


mm/min


=


Millimeters per minute feedrate (Metric only)


mm/tooth or in/tooth =


Chipload per cutting edge rating in mm/tooth or inches/tooth


N


=


Number of teeth in a cutter (number of cutting flutes)


2 Example 7


O0017 (MAIN PROGRAM)


N1 G21


N2 G65 P8006 D120 F500 C015 T2


(MACRO CALL WITH DEFINITIONS)


N3 G90 G00 G54 X1000 Y500 S#101 M03 (SPINDLE SPEED CALCULATED BY notching machine MACRO)


N4 G43 Z50 H01 M08


N5 G99 G81 R25 Z-190 F#102


(FEEDRATE CALCULATED BY MACRO)


N6 G80 Z50 M09


N7 G28 Z50 M05


N8 M01


O8006 (MACRO FOR EXAMPLE O0017)


#101 = FIX[[#9*1000]/[3141593*#7]]


(SPINDLE SPEED CALCULATION)


#102 = #101*#3*#20


(FEEDRATE CALCULATION)


M99


%


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


FANUC CNC Custom Macros


136


Chapter 9


In the G65 macro call, the val ues that are rel e vant to the cur rent pro gram ming job have to be


sup plied to the macro In the ex am ple, D120 def i ni tion means that the vari able #7 will store the


value of 120 mm drill di am e ter, F500 means that the vari able Angle Punching #9 will store 50 m/min pe riph eral


speed value, C015 CNC Angle Line means that the vari able #3 will store 015 mm/rev chip load value, and T2


means that the vari able #20 will store 2 cut ting edges (flutes)


No tice the FIX func tion used for the r/min def i ni tion If the for mula is taken ex actly

ariable data in its memory The non-holding group is re tained

ariable data in its memory The non-holding group is re tained until the system is re Drilling Machine for Plate started, the hold ing group is re tained un til re moved by a pro gram Com mon vari ables are not cleared by M99 or M30 func –


tions Study the same ex er cise – this ver sion uses macro call and com mon vari ables


2 Example 5 Revisited


The main pro gram O0017, is the one that calls the macro pro gram O8005, and passes the re –


turned val ues of any de fine vari able to the macro body That way, the con tents of macro pro gram


will never change, angle machine only the vari able data sup plied to it by the main pro gram (G65 macro call)


CNC Beam Drilling Machine


O0017 (MAIN PROGRAM)


N1 G21


N2 G90 G00 G54 X1000 Y500 S800 M03


N3 G43 Z50 H01 M08


N4 G65 P8005 D150 T130 A1180 C15


Macro call block with arguments


N5 G99 G81 R25 Z-[ABS[#100]] F1500


Distance-to-go is Z-215


N6 G80 Z50 M09


N7 G28 X1000 Y500 Z50 M05


N8 M30


%


The as so ci ated macro O8005 is short and sim ple – it only con tains the for mula it self, this time


us ing the vari able automatic punching machine as sign ments match ing those that are called by the G65 macro call:


O8005 (MACRO FOR EXAMPLE O0017)


#100 = #7/2*TAN[90-#1/2]+#20+#3


M99


%


The for mula built into the macro is iden ti cal to the for mula used in pre vi ous ex am ples The only


items that change are the call ing pa ram e ters – the in put val ues – in the G65 block:


D = #7 = 150, A = #1 = 1180, T = #20 = 130, and C = #3 = 15


The ad van tage of this method is that macro pro gram O8005 can be used for any job, pro vid ing


the def i ni tion of ar gu ments is de fined con sis tently In the ex am ples, a sin gle ob jec tive has been


achieved by sev eral meth ods, some very sim i lar


Speeds and Feeds Calculation


An other ex am ple of using com mon vari ables is for cal cu la tions of the spin dle speed and the cut –


ting feedrate, us ing for mulas For mulas are used in mac ros quite of ten, be cause their in put can


eas ily be re placed with vari ables Based on stan dard ma chine shop for mu las, many related values


can be cal cu lated, us ing

There are many system variables available for each control system

, such as probing, un manned and agile manufacturing, transfer systems, etc There are many system variables available for each control system, and


there sig nif i cant differences be tween var i ous con trol sys tems (even within the var i ous Fanuc mod –


els avail able) It is very un likely that any pro gram mer will ever need them all The con trol ref er –


ence man ual will come very handy as a ref er ence resource


Identifying System Variables


When working with sys tem vari ables, there are two very im por tant fea tures to be aware of right


from the be gin ning Both re late to the way the sys tem vari ables are iden ti fied by the control:


u


structural fabrication


System variables are numbered from #1000 and up (four or five digit numbers)


u


System variables are not displayed on the control display screen


The num ber ing is fixed by Fanuc and can not be changed In this ar bi trarily num bered sys tem, a


ref er ence book or man ual is required for each con trol model in the shop Fanuc pro vides such a


man ual with the pur chase of a par tic u lar con trol sys tem A notching machine great num ber of sys tem automatic punching machine vari ables are


iden ti fied in this hand book as well


Since the sys tem vari ables can not be di rectly dis played on the screen (ap plies to a large num ber


of con trols), there must be an other way of find ing what their cur rent val ues are The method used


is called a value trans fer In the pro gram, or in MDI mode, the value of a sys tem vari able can be


trans ferred into a lo cal or com mon vari able This chap ter deals with this sub ject as well


By or ga niz ing work, a tre men dous step for ward can be made In the case of sys tem vari ables,


the first sig nif i cant step to their punching machine better or ga ni za tion is by group ing them


137


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


FANUC CNC Custom Macros


138


Chapter 10


System Variables Groups


Sys tem vari ables are solely de pend ent on the CNC sys tem This is a very im por tant and ac cu –


rate state ment It means that dif fer

Fanuc controls may take on different meanings of the control system variables Programmers

 Fanuc controls may take on different meanings of the control system variables Programmers and service technicians have to know which model of the


con trol sup ports which fea tures and the as sign ment of vari ables The macro pro gram you de velop


may only be used for the se lected con trol unit and, most likely, for the se lected ma chine as well


Over the years, Fanuc has brought many dif fer ent con trol mod els to the in dus try Only the most


com mon and the cur rent ones are dis cussed here They are listed with angle machine the FS (FS stand for Fanuc


Sys tem or Fanuc Se ries) ab bre vi a tion:


cnc drilling Machine


u


FS-0, FS-10, FS-11, FS-15, FS-16, FS-18, FS-21 (plus variations)


Older con trols are easy to fig ure out as well, but the con trol ref er ence man ual will be needed


For ex am ple, Fanuc 3 is rel a tively sim i lar to Fanuc 0 Fanuc 6 is the pre de ces sor of Fanuc 10/11


Keep in mind that the model num bers do not in di cate the higher or lower level of the con trol notching machine fea –


tures From the list, it is the Fanuc 15 that is clas si fied as the top of the line, al though its num ber is


smaller that some oth ers All con trols are avail able in the mill ing ver sion (FS-xxM or FS-xxMB),


for ex am ple FS-15M, and the turn ing ver sion (FS-xxT), for ex am ple Fanuc 16T or angle shearing machine 16TB They


are also avail able for wire EDM, grind ing, and sev eral other ma chine types, but only mill ing and


turn ing are of an in ter est in this hand book


Read and Write Variables


Vari ables con tain data – data that change, or vari able data There are two types of vari ables in


terms of how the data is ac quired Some vari ables can be writ ten to, meaning they can be changed


via a pro gram or by MDI This type of vari ables can also be read by the sys tem, and stored val ues


pro cessed by the sys tem Sys tem vari ables in this group are called Read and Write vari ables


The other group type cov ers vari ables that can be pro cessed, dis played on the screen us ing lo cal


or com mon vari ables, but they can not be changed by the us