Archive for September, 2017

This is a millisecond timing variable

to (Read & Write or R/W)


Variable Number Description


This is a millisecond timing variable, with


the count of one millisecond at a time The


#3001


counting starts from zero when the power is


busbar Machine


turned on, and continues up to 655350


milliseconds, then starts from zero machine bending again It


counts all the time


This is an hour timing variable, with the


count of one hour at a time The counting


starts from zero when the cycle start is first


#3002


pressed, and continues to the 114534612


hours, then starts from zero again Timer is


updated only angle machine when the cycle start lamp is


turned in (in cycle start mode only)


This variable contains the current date, in the


form of year, month, day (format is


#3011


YYYYMMDD) A given date, for example,


December 7, 2005, will be displayed as


20051207


This variable indicates current time, in the


form of hours, minutes, seconds (format


#3012


HHMMSS) A time, for example, 8:36:17


pm, will be displayed in a 24-hour format


as 203617


Timing an Event


An event may be timed us ing ei ther the #3001 or #3002 sys tem vari ables The fol low ing ex –


am ple does not do very much in prac ti cal terms, but it is de signed in such a way that the ex pected


re sult may be cal cu lated


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


FANUC CNC Custom Macros


192


Chapter 14


Eval u ate the en closed com ments or try at the control to see how the timer works ex actly:


O8017 (TIMING AN EVENT)


(PART –ONE– USING #3001)


#3001 = 0


Reset to zero (start counting from zero)


G91 G01 X-1000 F2000


Duration of this motion is 30 seconds


X1000 F4000


Duration of this motion is 15 seconds


N999 (THIS MUST BE AN EMPTY BLOCK) An empty block to prevent look-ahead !!!


#101 = #3001


Returns calculation of 45632000 (milliseconds)


#102 = #3001/1000


Returns calculation of punching machine 00045632 (seconds)


M00


Temporary stop to check variables


(PART –TWO– USING #3002)


#103 = #3002


Reset to zero (start counting from zero)


G91 G01 X-1000 F2000


Duration of this motion is 30 seconds

Current axis Included position ABSOT Workpiece offset

set Not included Enabled ABSIO endpoint


(G54+)


#5021 to #5035


Current axis Machine position coordinate ABSMT system Disabled


#5041 to #5055


Current axis Included position ABSOT Workpiece offset


#5061 to #5075


busbar Machine


Skip signal


(G54+)


position


Enabled


ABSKP


( 2)


Current


#5081 to #5095


tool offset value


( 3)


Disabled


Amount of


#5101 to cnc shearing machine #5115


deviated


servo position


( 1 )


Each range of variable numbers is for 1 to 15 axes The first number is for the


X-axis,


the second number is for the Y-axis, the third number is for the Z-axis, the fourth


number is for the fourth axis, and so on up to the 15th axis possible


( 2 )


During the execution of the G31 skip function, the range of variables #5061 to


#5075


holds the tool position where the skip function is turned on If the skip function is


not turned on, this range of variables holds the end point of the specified block


( 3 )


Note that the tool offset value range of #5081 to #5095 represents the current tool


offset value, rather than the last value


( 4 )


Read operation during a tool movement can be enabled or disabled


In disabled mode, buffering takes place and the expected values cannot be read


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


FANUC CNC Custom Macros


AUTO MODE OPERATIONS


16


Dur ing CNC ma chin ing Dished Head Punching Machine in AUTO mode, the op er a tor de cides whether and when to use the var i –


ous over rides avail able on the ma chine operation panel Overrides in clude the Feedrate Over ride,


Feedhold, Spin dle Speed Over ride and Sin gle Block With the ex cep tion of the Spin dle Speed Over ride, all other func tions can be con trolled by macro and made ef fec tive or not ef fec tive In ad –


di tion, the macro can also con trol the Ex act Stop angle cutting machine Check mode and some wait code sig nals


Controlling Automatic Operations


Sys tem vari ables #3003, #3004 and #3005 are used to con trol the state of var i ous au to matic op er a tions All these vari ables use a bi nary for mat in dif fer ent com bi na tions (0

stead of an alarm insituations

stead of an alarm insituations that are not wrong, but when the op er a tor should Drilling Machine for Plate be warned or oth –


er wise in formed of an im por tant issue


For ex am ple, the fol low ing pro gram uses ar gu ment D (#7) as clear ance amount:


G65 P8016 D15


Macro call (D = #7 – is clearance amount)


In the macro body, the sys tem vari able #3006 is pro grammed in a for mat sim i lar to the alarm


vari able, but with a different number:


busbar Machine


O8016


IF [#7 LT 20] GOTO101


N100 GOTO9999


N101 #3006 = 1 (2 MM MINIMUM CLEARANCE RECOMMENDED)


N9999 M99


%


When the pro gram mes sage is ac ti vated, the CYCLE START light of the con trol will be turned


off and the mes sage will ap pear on the screen When the CNC op er a tor presses the CYCLE START


but ton again, the part pro gram pro cess ing will con tinue No re set is nec es sary in this case and


there is no need to press the RESET but ton – it will ac tu ally be a coun ter pro duc tive ef fort, as it


would can cel pro gram execution Watch the flow of the macro here – the pro gram may be con –


structed in such a way that the by pass block may not be needed, even if the con di tion is true


Use the mes sage vari able spar Dished Head Punching Machine ingly This is an ex am ple when the pro gram mer is giv ing up cer –


tain con trol over the pro gram and leaves it in the hands of the CNC ma chine op er a tor


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


FANUC CNC Custom Macros


ALARMS AND TIMERS


191


Timers in Macros


In the last sec tion of this chap ter, the topic covers strictly pro gram ma ble tim ers, not tim ers re –


lated to hard ware set tings in the ser vice or main te nance sense There are sev eral sys tem vari ables


avail able on Fanuc con trols re lat ing to timers Ba si Angle Punching cally, these vari ables cover the in for ma tion


about the date and time, and sev eral other op tions for tim ing var i ous events


Time Information


Sys tem vari ables #3001, #3002, #3011, and #3012 re late to the var i ous time data Time in –


for ma tion may be read as well as writ ten

Duration of this motion is 15 seconds

Duration of this motion is 15 seconds


N999 (THIS MUST BE AN EMPTY BLOCK) An empty block to prevent look-ahead !!!


#104 = [#3002-#100]*3600


Returns calculation of 45631993 (seconds)


M00


Temporary stop to check variables


M30


busbar Machine


End of program


%


Note the blocks N999 and the at tached com ment Since the con trol is in the look-ahead mode, it


cal cu lates the fi nal value pre ma turely The empty block guar an tees ac cu rate cal cu lated value


Dwell as a Macro


Al though the dwell func tion G04 can be used much more ef fi ciently in the ma jor ity of pro –


grams, the dwell may also be pro grammed with a macro, us ing the sys tem vari able #3001 For


ex am ple, G04 P5000 (a five sec ond dwell) is equiv a lent to the fol low ing macro (and its call):


u


Macro call:


G65 P8018 T5000


T=#20 can be any other local variable (T is in ms)


u


Macro definition:


O8018 (TIMER AS A DWELL)


#3001 = 0


Set system variable for timer to zero


WHILE[#3001 LE #20] DO1


Loop until #3001 reaches the set delay


END1


Loop end


M99


Macro end


%


Note that even with the WHILE loop in ef fect, there is no automatic punching machine need to pro gram a coun ter, since the


sys tem vari able #3001 is al ways count ing


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


FANUC CNC Custom Macros


AXIS POSITION DATA


15


Dur ing ma chin ing, the cut ting tool lo ca tion changes con stantly Look ing at the con trol Po si tion


dis play screen, the cur rent tool lo ca tion can eas ily be viewed at any time There are sev eral ways


of look ing at the displayed data, for ex am ple, the view may show the cur rent ab so lute po si tion of


the tool (from pro gram zero), busbar punching machine or the ma chine po si tion of the tool (from ma chine zero) – they are


just two pos si ble op tions Con trol sys tem keeps track of all po si tion re lated tool copper busbar machine data, called the


axis po si tion in for ma tion They are de scribed in this chap ter


Axis Position Terms


Fanuc uses sev eral ab bre vi a tions that ap pear in the ref er ence man ual They should be fa mil ia

any macro programmer who works with axis positions They make look a bit in timidating

to any macro programmer who works with axis positions They make look a bit in timidating at


first, but are log i cal and easy to get used to These are the four variables that re late to the axis po –


si tion information:


2


ABSIO


ABSMT ABSOT ABSKP


u


busbar Machine


ABSIO


Programmed endpoint coordinate of the previous block


#5001 – #5015


for the 1st to 15th axis respectively


u


ABSMT


Machine position – always current machine coordinates


#5021 – #5035


for the 1st to 15th axis respectively


u


ABSOT


Absolute position – always current angle machine absolute position


#5041 sheet metal cutter – #5055


for the 1st to 15th axis respectively


u


ABSKP


Position stored during a block skip motion in G31 block


#5061 – #5075


for the 1st to 15th axis respectively


In ad di tion, there are two sets of sys tem vari ables re lat ing to the tool length off set value, and


servo sys tem de vi a tion er ror


The stored Ma chine and Ab so lute co or di nates are the same as dur ing a reg u lar op er a tion of the CNC notching machine ma chine In mac ros, it means we can not reg is ter (store) the cur rent axis po si tion value, un til


the ac tive block has been com pleted This is very use ful in the block skip mode us ing the G31


com mand for prob ing, but may be un de sir able in many other cases The sys tem vari able range of


#5001 to #5015 stores the pro grammed end point (XYZ) of the last block be fore the macro


state ment, even if these co or di nates have not been ac tu ally reached That al lows for ex e cu tion and


cal cu la tions to be done be fore the next block Im proved pro cess ing speed is the re sult


The G31 skip mo tion com mand is de scribed at the end of Chap ter 23


193


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


FANUC CNC Custom Macros


194


Chapter 15


Position Information


Vari ables #5001 to #5115 are read-only vari ables, and can not be writ ten to