Look at the program only as the objective states

Sep 04
2017

N1 G21


N2 G90 G00 G54 X1000 Y500 S800 M03


N3 G43 Z50 H01 M08


N4 G99 G81 R25 Z-#3 F1500


(DISTANCE-TO-GO IS Z-215)


N5 G80 Z50 M09


N6 G28 X1000 Y500 Z50 M05


N7 M30


H beam high-speed Drilling


%


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


FANUC CNC Custom Macros


130


Chapter 9


Look at the program only as the objective states – was the ob jec tive achieved? The ex am ple


shows yes, it was The to tal Z-axis tool travel will be Z-215 (this is in di cated at the con trol as


Dis tance -To-Go) Re mem ber, the ‘dis tance to go’ is mea sured from the start point punch machine for Head (R-level) to the


Z-depth What is the re turned value of Busway Press Clamp Machine vari able #3? Once the pro gram is com pleted (M30 func –


tion), or the re set but ton is pressed, all lo cal vari ables are cleared The screen dis play of macro


vari ables will show no val ues There are no vari able data shown, be cause there are no vari able


data stored – all were flushed out of the mem ory, be cause they were de fined as lo cal vari ables


There is no need to keep a value al ready used in the mem ory, once the job is done If the same


pro gram is applied for a dif fer ent drill di am e ter and/or plate thick ness, just change the #1 and/or


#2 vari ables, and the new val ues of the Z-depth will be cal cu lated au to mat i cally and cor rectly for


any 118掳 tool point an gle (within the macro framework)!


There are other parts of the pro gram that could ben e fit from vari able data, but the fo cus of the


examples is on the Z-depth cal cu la tion only As an im prove ment, for ex am ple, the spin dle speed


and the feedrate would have to change with each drill di am e ter and a few other data as well


2 Example 2


In the sec ond ver sion of the ex am ple, only a mi nor change will be drilling tools made Look at the cal cu la tion


of the Z-#3 in block N4 above? The cal cu la tion of vari able #3 al ways pro duces a pos i tive re sult, but in the pro gram, the Z-depth must be neg a tive By making two changes in the pro gram, the re –


sult of the #3 cal cu la tion will be neg a tive a

given thick ness Sev eral ver sions of the pro gram will show

Sep 04
2017

given thick ness Sev eral ver sions of the pro gram will show the continuously improved progress in development and use of the many available programming tools


Compare copper busbar bending machine the dif fer ences be tween in di vid ual pro grams


The first few ex am ples will use lo cal vari ables, later ex am ples will use com mon vari ables


Using Local Variables


A re minder – all lo cal vari ables used by the pro gram will be dis carded when M30 or M99 is ex e –


cuted, or when the RESET key at the con trol panel is pressed


2 Example 1


In the Busway Press Clamp Machine ini tial ver sion, eval u a tion of the job finds that four items have to be dealt with:


o


H beam sawing Machine


Drill diameter


o


Plate custom processing machine thickness


o


Tool point length


o


Clearance for the drill penetration


In or der to make the pro gram flex i ble, choose the drill and the plate thick ness as vari able data,


then se lect de faults for the tool point length and the pen e tra tion clear ance To store the drill di a m –


e ter, vari able #1 will be used, to store the plate thick ness, vari able #2 will be used Since only


118掳 point an gle drills will be used, the stan dard de fault con stant of 03 is used to cal cu late the


tool point length (for mula de ter min ing the con stant is listed later in this sec tion) The other de fault


in the pro gram will be the clear ance be low the plate for the drill pen e tra tion Se lec tion of 15 mm


is rea son able The first pro gram with macro fea tures uses a very sim ple and ba sic ap proach:


O0011 (MAIN PROGRAM 1)


#1 = 150


(DRILL DIAMETER)


#2 = 130


(PLATE THICKNESS)


(鈥斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€旓拷?


#3 = #1*03+#2+15


(Z-DEPTH CALCULATION – POSITIVE VALUE OF 190)


(鈥斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€斺€旓拷?

the inner most function of the supplied data is processed first

Sep 03
2017

as nested func tions) are al ways eval u ated from the in side out That


means the inner most function of the supplied data is processed first, then the next func tion, then


the one af ter and so on and on In the test ex am ple, the in ner most func tion for #149 vari able def i –


ni tion is ROUND[#148]


Since the pre vi ously stored value of vari able #148 is 28334253, the func tion is eval u ated as


ROUND[28334253], and its re turn value is 3 At this point, the func tion looks like this:


#149 = #[FUP[#[3]]]


cnc drill Machine


where the re turn value of the ROUND func tion has been sub sti tuted The new in ner most func –


tion now is #[3] That is a ref er ence to a vari able #3 From the ear lier def i ni tion, in the G65


state ment, #3 is des ig nated by the C let ter and had been as signed value of 1427 The def i ni tion at this point looks like this:


#149 = #[FUP[1427]]


where the pre vi ously stored value hydraulic busbar cutter hole punching machine of the #3 has re placed the in ner cal cu la tion The new cur –


rent in ner drilling steel most cal cu la tion is FUP[1427] The FUP func tion re turns the next higher in te ger,


which is 2 in this case So the next ver sion of the eval u a tion is:


#149 = #[2]


This is a sim ple form to eval u ate:


#149 = #[2]


is the same as


#149 = #2


Since #2 is de fined by the B let ter in the G65 macro call and B is equal to 420, there fore, the fi nal mean ing – the ever im por tant re turn value – of vari able #149 is:


#149 = 420


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


FANUC CNC Custom Macros


MACRO FUNCTIONS


129


Approach to Practical Applications


This sec tion in cludes sev eral sam ples of stan dard pro grams and mac ros work ing to gether The


fol low ing ex am ples il lus trate the macro for mat and the prac ti cal use of vari ables in dif fer ent ways


As in a stan dard CNC pro gram, when writ ing a macro, there has to be a pur pose – an ob jec tive In


the ex am ples, the sin gle ob jec tive is to use macro fea tures to cal cu late the Z-depth for a drill cut –


ting through a plate of a

PMC is Fanuc ver sion of PLC

Sep 03
2017

mable Machine Control, and is not available on all Fanuc control models) PMC is Fanuc ver sion of PLC – Pro gram ma ble Logic Con trol ler The two


func tions as so ci ated with the con ver sion are:


BCD BIN


BCD func tion con verts Bi nary Coded Dec i mal for mat into a Bi nary for mat, and the BIN func –


tion con verts Bi nary for mat into a Bi nary Coded Dec i mal for mat These are not cnc cutter com mon func tions in a typ i cal macro ap pli ca tion, but if used, the knowl edge of bi nary num bers is es sen tial


Evaluation of Functions – Special Test


CNC Beam Drilling Machine


The knowl edge of how Fanuc con trol sys tem ac tu ally eval u ates macro func tions is a crit i cal el e –


ment of any macro pro gram ming The next page con tains a very com pre hen sive test that cov ers as


many func tions as pos si ble, sev eral of them de pend ent on each other All an swers are pro vided as


re turned val ues next to the macro state ment, ex cept the last one, which is a spe cial chal lenge (see


com ments fol low ing the test) The test is based on the fol low ing G65 block:


G65 P8888 B420 C1427 H300 X0003


Four arguments defined for the test


The custom processing machine above block calls a macro pro gram O8888 and passes four de fined ar gu ments to vari ables


B=#2=420, C=#3=1427, H=#11=300 and X=#24=0003 The macro O8888 has been


spe cif i cally de signed for train ing pur poses and ap plies var i ous func tions as ex am ples of us age


The or der of data en try must be fol lowed as pre sented Place a sheet of pa per to hide the re turn


val ues from view, take a cal cu la tor, and try to iden tify the re turn val ues be fore look ing at the re –


sults (all lead ing ze ros that may ap pear on the con trol screen are omit ted in the re turned val ues):


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


FANUC CNC Custom Macros


MACRO FUNCTIONS


127


O8888 (EVALUATION OF FUNCTIONS – SPECIAL TEST)


#100 = #11


300000


#101 best mill drill = #2

Visit Our Friends!

A few highly recommended friends...

Pages List

General info about this blog...