num ber from the con trol system mem ory In this re spect, all rules of a subprogram
num ber from the con trol system mem ory In this re spect, all rules of a subprogram
def i ni tion have to be fol lowed in a macro def i ni tion
What is dif fer ent in the macro pro gram de vel op ment, are the vari able def i ni tions, func tions and
log i cal con di tions Vari able def i ni tions use vari ables to store var i ous data Vari ables are tem po –
rary stor age ar eas of the con trol sys tem mem ory – in the macro body they are de fined with a spe –
cial sym bol – the # sign Even at their sim plest level, mac ros will use vari ables, there fore they
will use the # sym bol The up com ing chap ters of fer a lot more in for ma tion and de tails
Variables are the single most important key to macro programming
Macro Call
Vi sually, the ma jor dif fer ence be tween call ing a subprogram and call ing a macro is de fined by
the pro gram ming for mat Logically, both calls are the same copper hole punching machine busbar bending machine and serve the same gen eral pur pose
In both cases, a pre vi ously stored custom processing machine pro gram (a subprogram or a macro) is re trieved from the con –
trol stor age area by a spe cific pro gram code:
M98 P—-
Calls a subprogram P—-
(additional data are not normally required)
G65 P—-
Calls a macro P—-
(additional data are normally required)
Copyright 2005, Industrial Press Inc, New York, NY – wwwindustrialpresscom
FANUC CNC Custom Macros
76
Chapter 6
Fanuc con trol sys tem pro vides a G-code (pre pa ra tory com mand) to call a pre vi ously de fined
macro rather than a mis cel la neous func tion M used for subprograms This com mand is G65, and
rep re sents the call of a macro pro gram by its stored num ber, sup ple mented by ad di tional data
The fol low ing struc ture ex am ples il lus trate the dif fer ences:
2 Example 1 – Main program and a SUBPROGRAM :
O0004 (MAIN PROGRAM)
N1 G21
Startup block
N2 锟?
N15 M98 P8001
Call stored subprogram O8001
N16 锟?
N52 M30
End of main program
%
O8001 (SUBPROGRAM)
N1 锟?
N2 锟?
N14 M99
End of subprogram
%
2 Example 2 – Main program and a MACRO :