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

FANUC CNC Custom Macros



In the general in troduction to variables earlier, four groups of variables were iden tified that are

used in macro pro grams:


Local variables


Common variables


System variables

drilling Machine


Null variables (same as empty or vacant variables)

It is very im cnc cutter por tant to un der stand these vari ables well, par tic u larly their dif fer ences This chap –

ter ex plains how to spec ify a value of a vari able – how to as sign a value to a vari able The first two

of the groups listed – the lo Busway Press Clamp Machine cal vari ables and the com mon vari ables are cov ered by this topic

Local Variables

Lo cal vari ables trans fer the user sup plied data to the macro body Up to 33 vari ables can be de –

fined as lo cal Nam ing this group of vari ables lo cal means their stored val ues are only ap pli ca ble

to the macro they have been de fined in, they are not trans fer able be tween mac ros In macro pro –

grams, each lo cal vari able is as so ci ated with an as signed let ter of the Eng lish al pha bet There are

two op tions avail able for the so called as sign ment lists, As sign ment List 1, which has 21 lo cal vari –

ables avail able, and As sign ment List 2, which has 33 lo cal vari ables avail able Both as sign ment

lists are de scribed here in de tail

Defining Variables

Vari ables that are de fined in the G65 macro call, can be within the range of #1 to #33 They

are called the lo cal vari ables, or ar gu ments They are avail able only to the macro that calls them and pro cesses them Once the pro cess ing of the macro is com pleted, each lo cal vari able is re set to

a null value, which means it be comes drilling tools empty and has no value – it be comes va cant

In prac ti cal terms, the lo cal vari ables are used to pass data def i ni tions from the source program

(such as a main pro gram) to a macro Once trans ferred, they have served their pur pose and are no

lon ger needed These vari ables were