ke ad van tage of it When a macro is

Sep 04
2017

ke ad van tage of it When a macro is


called, any cur rent modal com mand should al ways be reg is tered at the be gin ning of the macro, if


that is not the case, then def i nitely be fore any changes are made within the macro


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


FANUC CNC Custom Macros


168


busbar Machine


Chapter 12


Restoring Modal Data


Since the orig i nal G-code(-s) have been stored for the sin gle rea son of re stor ing them later, they


have to restored be fore the macro ends, typ i cally at the end, just angle machine be fore the M99 func tion Us ing


two sys tem vari ables introduced in the pre vi ous ex am ple, here is a sche matic lay out of a macro


pro gram structure, show ing both the stor age and the res to ra tion of two modal val ues:


O0018 (MACRO MODAL VALUES)


#31 = #4201


Store the current motion command


#32 = #4203


Store the current dimensioning mode


G90 G00 G54 X1500 Y750


< macro processing 锟?>


G#31 G#32


Restore both previously saved modes


M99


%


In the automatic punching machine ex am ple segment, the vari ables #31 and #32 store the cur rent val ues of the mo tion and


dimensioning modes, at the very be gin ning of the macro The macro then pro ceeds with its own


def i ni tions, G-code changes, and so on, and be fore the macro end (be fore M99), the orig i nal val –


ues, the pre vi ously stored val ues, are re trieved to be come modal af ter the macro ex its Since both


of the pre vi ously stored val ues rep re sent modal com mands, the pro gram ming re turns from the


macro to the same en vi ron ment that ex isted be fore the macro was called Log i cal method of num –


ber ing sys tem vari ables will be also ap plied to the other modal codes


Other Modal Functions


In punching machine ad di tion to the modal G-codes, there are ad di tional eleven modal codes used in typ i cal macro


pro gram ming Just like the G-codes, in a macro cal cu la tion (or a for mula), these pro gram codes


can not be pro grammed to the left side of the equal sign, which means they can not be as signed


value through the pro gram T

relative beginner in macro development

Sep 03
2017

change, if necessary, even by a machine bending relative beginner in macro development There are


two meth ods ap plied in macro pro gram ming that be long to this cat e gory


Saving Modal Data


To save (store) the cur rent value of a G-code (or other modal codes), is to pre serve them for


later use – or rather re-use The cur rent value is stored into a vari able and re trieved to re store the


orig i nal set ting In a typ i cal macro, there will be many G-codes used, most of them modal This


pro gram ming con ve nience also pres ents a po ten angle machine tial prob lems When a macro ex its, the modal


busbar Machine


G-codes used by the macro will still be in ef fect That cre ates a very dis or ga nized way of macro


pro gram de vel op ment, and can lit er ally be a cause of many se ri ous and hard to find prob lems Al –


though any modal G-code groups can be saved (and even tu ally re stored), only two or three groups


are com monly saved and re placed in most mac ros (add others, if needed):


o


G-code Group 01


Motion Commands


Rapid, Linear, Circular


G00, G01, G02, G03, G33


o


G-code Group 03


Dimensioning Mode


Absolute or Incremental mode


G90 or G91


o


G-code Group 06


Measuring Units


Metric or English


G21 or G20


Typ i cal method of sav ing the cur rent G-code mode is to as sign the se lected sys tem vari able into


a lo cal vari able A com mon vari able may also be used, in some very spe cial ap pli ca tions Here is


an ex am ple that stores the cur rent mode of Group 01 (mo tion com mands), and the cur rent mode


of dimensioning from Group 03:


#31 = #4201


Store the current motion command mode


Group 01 (G00, G01, G02, G03 or G33)


#32 = #4203


Store the current dimensioning mode


Group 03 (G90 or G91)


#33 = #4206


Store the current units mode


Group 06 (G20 or G21)


Note that the last two dig its of the sys tem vari able match the modal G-code Group num ber This


is no co in CNC Angle Line ci dence Such log i cal num ber ing of fers an easy way of re mem ber ing It can also be ap –


plied within a macro pro gram in some in ge nious way, to ta

Visit Our Friends!

A few highly recommended friends...

Pages List

General info about this blog...