Initialize counter to the first variable (no # symbol !!!)

Initialize counter to the first variable (no # symbol !!!)

WHILE[#33 LE 999] DO1

Loop through variables – shown range is #500-#999

#[#33] = #0

Set the current variable number to null (clear current variable)

busbar Machine

#33 = #33+1

Update variable number busbar bending machine count by one


End of loop – return to the WHILE block and evaluate again


End of macro


Vari able #33 is a lo cal vari able and serves as a coun ter Its ini tial set ting is 500, the first vari –

able of the range to be cleared The max i mum range is con trolled by the WHILE loop, and the ex –

am ple shows #999 as the last vari able in the range This num ber should be changed to match the

con trol sys tem This is also a macro, where the ba sic G65 state ment needs no ar gu ments:


Main program number

G65 P8011

Calls macro O8011 to clear all 500+ variables – no arguments


End of main program O0019


The macro O8011 can be very eas ily adapted to learn ing vari ables in the 100+ se ries as well

Just change the ini tial set ting (#33) and the max i mum rage in the WHILE loop

Many ex am ples in the hand book use branch ing and loop ing func tions that can be used in ev ery –

day work The ma jor ity of them con tain com ments and ex pla na tions along with prac ti cal ap pli ca –

tions Use them as a re source to cre ate unique mac ros that can be Dished Head Punching Machine used on a daily ba sis

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

FANUC CNC Custom Macros



The idea of ac tu ally caus ing an alarm dur ing ma chin ing op er a tions by a CNC pro gram may be a

bit un com fort able or even pe cu liar to many us ers, re gard less of ex pe ri ence Yet, cre at ing a spe –

cific con trol sys tem alarm – for a good rea Angle Punching son, of course – is noth ing more than ap ply ing a very

im por tant tool in macro de vel op ment Even un der nor mal op er at ing con di tions, all con trol sys –

tems au to mat i cally switch to the alarm mode, if a se ri ous and de tect able prob lem oc curs The key –

Leave a Reply