CFP - Academy CFP - Academy SFA Macro / Gcode Class Fanuc Version Date Description of revision Drawn up by 01.00 3/09/2015 Document draft 1 Jack Faas Checked by TABLE OF CONTENTS Contents COMMON MACRO PROGRAMS USED AND DESCRIPTION ......................................................................... 4 COMMON PLC MACRO VARIABLES ........................................................................................................... 5 COMMON GCODE OR CONDITIONAL COMMANDS IN CMS MACROS ....................................................... 6 EASYSTONE / WINTOOLS PROGRAM AND MACHINE MACROS ................................................................. 7 STANDARD PROGRAM SECTION .............................................................................................................. 12 COMMON MACRO PROGRAMS USED AND DESCRIPTION First point we need to bring up Fanuc is pretty liberal about the word MACRO, it can mean two things typically. The first is Macro as a sub program, on your Fanuc’s this means typically O8000 to O9999 programs. The second is Macro as a variable, as in macro numbers #1 to #9999. Common Macros loaded onto CMS Machines and description. (Your machine may have more or less then the listed below. O9003 Mode Selection 3 Axis O9004 Mode Selection 5 Axis O9005 End of Reference O9006 Tool Change O9007 Tool Change Restore O9008 Axis Reset ( Axis Registry Clear ) O9009 Position of Tool Change Locations O9011 Movement Modality G351 O9012 Movement Modality G352 O9014 Movement Modality G353 O9015 Movement Modality G354 O9016 Movement Modality G355 O8971 Orientate Plane Shift Around Z O8991 Wintools / Easystone Messages Italian O8992 Wintools / Easystone Messages English O8993 Wintools / Easystone Messages German O8994 Wintools / Easystone Messages Spanish O8995 Wintools / Easystone Messages French COMMON PLC MACRO VARIABLES These variables are used to interface with the PLC or are set directly by the PLC. Many reactions that happen inside of the macro programs are dependent on these. Again your machine may use more or less then what is listed. #1000 = 1 Spindle Stopped (G54.0) #1001 =1 Tool Magazine Protection Open (G54.1) #1002 =1 Tool Present and Clamped (G54.2) #1003 =1 Magazine Disk Forward (G54.3) #1004 =1 Magazine Disk Back (G54.4) #1005 =1 Tool In Spindle Equals New Tool Called (G54.5) #1006 =1 Tool In Spindle Equals Zero (G54.6) #1007 =1 5 axis Working (G54.7) #1008 =1 Lathe Disabled (G55.0) #1009 =1 Tool Change Interrupted (G55.1) #1010 =1 Drives Reporting Enabled (G55.2) #1014 =1 Program O9016 in Progress (G55.6) #1020 =1 User KEY1 (G56.4) #1021 =1 User KEY2 (G56.5) #1022 =1 User KEY3 (G56.6) #1023 =1 User KEY4 (G56.7) #1030 =1 Zone Preselected Right / Front (G57.6) #1031 =1 Zone Preselected Left / Back (G57.7) #1034 Tool Number in Spindle ( Plc calculation ) #1035 Tool Number Called with M6 ( Plc calculation ) To view these values on the machine Press CTRL + F4, then PMC, then PMCDGN, then SATUS. Then type G and the number listed next to the variable and press SEARCH. These are binary, so start counting at Zero and right to left. COMMON GCODE OR CONDITIONAL COMMANDS IN CMS MACROS Conditional and Goto Statements EX: IF[#1034EQ0]GOTO20(TMAND=0) IF[#1034LT28]GOTO55 IF[#1034GT44]GOTO200(TMAND>44) GOTO10 EQ = LT < GT> Purposeful Program Hold Waiting For a Condition EX: N19 M00(TOGLIERE UTENSILE) N20 IF[#1002EQ1]GOTO19 EX: N80 IF[#1000EQ0]GOTO80(ASPETTA MANDR.FERMO ) IF[#1001EQ0]GOTO80(ASPETTA MAG.1 APERTO) G0G90G53Z#532 Parameter Writes EX: (LIMITI DI LAVORO Y G10L50 N1320P2R2701000 N1320P6R2701000 G11 ) Writes to Parameter 1320 Axis Y and V a functional value of 2701.000 mm EASY STONE / WINTOOLS PROGRAM AND MACHINE MACROS The Below are all of the variables ( MACROS ), that are used by EASYSTONE / WINTOOLS. Some are set at the machine others are set by the CNC program Configurable variables in the piece program generated by Easystone / Wintools #600= piece thickness ( mm / inch ) It carries out the origin translation in Z ; #601=suction cup positioning ( 0 or 1 ) If #601=0 the CN switches directly to the piece machining; If #601=1 the CN carries out the suction cup positioning and then the piece machining; #602=simulation ( 0 o 1 ) If #602=0 the CN carries out the piece machining: If #602=1 the CN carries out the simulation of the piece machining: #603=offset in x ( mm / inch ) It carries out the translation in X of the suction cup position (but not of locks and vices) and also of the piece machining; #604= offset in y ( mm / inch ) It carries out the translation in Y of the suction cup position (but not of locks and vices) and also of the piece machining; #605= radius over material ( mm / inch ) It is algebraically additional to each single over material reducing or enlarging the piece; it works only with CN-controlled machining’s; #606= suction cup blowing ( 0 or 1 ) If #606=0 the CN disables the suction cup blowing; If #606=1 the CN enables the suction cup blowing after the suction cup positioning when the machining is over; #607= manual origin ( 0 or 1 ) If #607=0 the CN uses the values calculated by Wintools as origin offset; If #607=1 the CN uses the values already existing on the current origin CN as origin offset; #608= software origin (included between 54 and 58) Insert the origin number to be used considering the value field indicated; Number 59 corresponding to G59 origin is used in the pre-setting programs, tool facing and grooving and what not, so it must not be used; #609= Table Selection ( 0 or 1 ) If #609=1 the program selects table1 ; If #609=2 the program selects table2 ; Configurable variables directly on the CNC macro area #621= Tool number of the suction cup positioning ( value field included between 1and the maximum number of magazine stations; besides, if you want the centring pin as a ground tool the field goes from 45 to 99 ); for example, by entering 10 the CN carries out T10 M6 before executing the suction cup positioning; #622=Tool control number coupled to the tool for the suction cup positioning ( included between 1 and 400 ) For example, by entering 150 the CN activates the H150 tool control before carrying out the suction cup positioning; #623= Use or non-use of the centring tool for the suction cup positioning ( 0 or 1 ) If #623=0 it carries out the suction cup positioning considering the centring tool; If #623=1 it carries out the suction cup positioning considering a normal tool; #624= Position of machine rest in X ( mm / inch ) For example, entering -3200 the machine executes G53 X-3200 after the suction cup positioning and at the end of the machining; #625= Position of machine rest in Y ( mm / inch ) For example entering 1600 the machine executes G53 Y1600 after the suction cup positioning and at the end of the machining; #626= Positioning error calibration of table holes in X ( mm / inch ) For example entering 5.34 the machine translates everything in X by 5.34mm for the suction cup positioning and the piece machining; This is used in case the table holes have moved to X due to any possible reason; with this function the piece program generation is rectified to fit it in with the table holes in X; #627= Positioning error calibration of table holes in Y ( mm / inch ) For example entering -3.70 the machine translates everything in Y by -3.70mm for the suction cup positioning and for the piece machining; This is used in case the table holes have moved to Y due to any possible reason; with this function the piece program generation is rectified to fit it in with the table holes in Y; #628= Origin dimension in Z suction cups ( mm / inch ) For example entering -324.6 the piece program writes the origin in Z on the CN before executing the suction cup positioning and/or the piece machining; The same is carried out for any origin in use; #629= Grooving table positioning calibration in X ( mm / inch ) The distance in X must be entered between the machine origin and the right bottom corner of the grooving table; With this function the grooving table position is calibrated in X with reference to the program generated by Wintools; #630= Grooving table positioning calibration in Y ( mm / inch ) The distance in Y must be entered between the machine origin and the right bottom corner of the grooving table; With this function the grooving table position is calibrated in Y with reference to the program generated by Wintools; #631= Origin dimension in Z of grooving table ( mm / inch ) For example entering -375.the piece program writes the origin in Z on the CN before executing the lock positioning and/or the piece machining; This procedure is carried out for any origin in use; #632= Upper movement when starting the program execution of the retractable suction cup ( 0 or 1 ) If #632=0 the CN never lifts the retractable suction cup; If #632=1 the CN lifts the retractable suction cup before the suction cup positioning and/or machining; #633=...Upper movement when starting the program execution of the second retractable suction cup and/or inclined plane, ( 0 o 1 ). If #633=0 the CN never lifts the second retractable suction cup and /or inclined plane; If #633=1 the CN lifts the second retractable suction cup and/or inclined plane before executing the suction cup positioning and/or piece machining; #634= Enabling / disabling of tool blowing while drilling ( 0 o 1 ) If #634=0 the CN does not execute the blowing while drilling a hole; If #634=1 the CN executes the blowing while drilling holes; #635= Blowing time in seconds ( included between 0 and 5 sec ) If for example you enter 3.4 the machine stops at the end of a hole drilling, blowing for 3.4secs before rising to Z and carrying out the next hole; #636= First tool control in ascending order on which the blowing is active ( included between 1 and 400 ) If for example you enter 43 the machine does not carry out the blowing during the drilling phase for tools whose tool controls have a number below H43; #637= Last tool control in ascending order on which the blowing is active ( included between 1 and 400 ) If for example you enter 113 the machine does not carry out the blowing during the drilling phase for tools whose tool controls have a number below H113; Variables used for the management of the above-mentioned performances Introduction The variables mentioned until now may be modified, in fact the CNC cannot machine a piece if a value is not assigned to them. The following variables instead are used by the piece program for the management of the various performances, like for example for the foreign language messages, the origins, the grooving, the pre-setting etc., so they must not be changed. #700= It contains the subprogram number for the management of foreign language messages; #701= It contains the number for switching into the foreign language message subprogram #702= Used for reading the origin stored on the CN when using the manual origin #703= It contains the dimension in X origin for writing on the CN #704= It contains the dimension in Y origin for writing on the CN #705= Total offset value (comprehensive of table drilling position calibration) in X #706= Total offset value (comprehensive of table drilling position calibration) in Y #707= It reads the metrical system set on the machine through the variable #4006 #720 - #729 = Variables used for the management of GROOVING #740= Variables for the PRE-SETTING management STANDARD PROGRAM SECTIONS % (CAT.CNC) ( PIECE THICKNESS ) #600=1.181 ( SUCTION CUP POSITIONING ) #601=0 ( SIMULATION ) #602=0 ( OFFSET IN X ) #603=0 ( OFFSET IN Y ) #604=0 ( OVERMATER. RADIUS ) #605=0 ( SUCTION CUP BLAST ) #606=0 ( MANUAL ORIGIN ) #607=0 ( SOFTWARE ORIGIN ) #608=56 ( WORK TABLE = 1 OR 2 ) #609=1 (F./CAT.EST - 10/02/2015 - 11.21.26) (MAXIMA2T.PPF V.2.1D1) IF [#609 EQ 1] GOTO 111 IF [#609 EQ 2] GOTO 222 N111 M70 M41 GOTO 112 N222 M71 M53 N112 #700=8992 (MM/INCH) IF [#4006 EQ 21] GOTO 1021 #707=25.4 GOTO 1022 N1021 #707=1 N1022 #708=0 (ORIGINE) #703=[-141.732+#626] #704=[0+#627] IF [#607 GT 0] GOTO 1031 #713=[-77.1848+#626] #714=[201.4764+#627] GOTO 1032 N1031 #702=[#608-53]*20 #713=[#[5201+#702]+#626] #714=[#[5202+#702]+#627] N1032 #705=#603 #706=#604 G10 L2 P[#608-53] X#703 Y#704 Z#631 #701=0 M98 P#700 G90 G0 G49 G53 Z0 G0 M5 (VENTOSE SU) IF [#632 EQ 0] GOTO 1041 M41 N1041 IF [#633 EQ 0] GOTO 1042 M53 N1042 ( POSIZIONAMENTI) IF [#601 EQ 0] GOTO 1100 T#621 M6 H#622 G#608 M15 M39 M93 ( RIFERIMENTI) #701=12 G52 X0 Y0 Z[[15+10*#623]/#707] G0 X110.236 Y216.535 G43 Z0 M98 P#700 G52 Z0 Z[130/#707] #701=12 G52 X0 Y0 Z[[15+10*#623]/#707] G0 X94.488 Y200.787 G43 Z0 M98 P#700 G52 Z0 Z[130/#707] #701=12 G52 X0 Y0 Z[[15+10*#623]/#707] G0 X78.74 Y200.787 G43 Z0 M98 P#700 G52 Z0 Z[130/#707] ( VENTOSE) #701=32 G52 X#603 Y#604 Z[[14+10*#623]/#707] G0 X98.114 Y212.972 G43 Z0 M98 P#700 G52 Z0 Z[130/#707] G90 G0 G49 G53 Z0 N1100 G10 L2 P[#608-53] X#713 Y#714 Z#631 IF [#602 EQ 0] GOTO 1210 #701=1 M98 P#700 M15 M38 M92 GOTO 1 N1210 IF [#609 EQ 1] GOTO 333 IF [#609 EQ 2] GOTO 444 N333 (REST POSITION FOR TABLE 1) G53 G0 X#640 Y#641 IF [#606 EQ 0] GOTO 334 M25 N334 GOTO 113 N444 (REST POSITION FOR TABLE 2) G53 G0 X#642 Y#643 IF [#606 EQ 0] GOTO 335 M55 N335 N113 #701=2 M98 P#700 G0 M5 G90 G0 G49 G53 Z0 (BREAK) N1 (FRE=PART1,GOLD MILL,GOLD MILL) T3 M6 H29 G#608 G52 X[0+#705] Y[0+#706] Z[0+#600] /M8 G90 G0 X49.461 Y22.5 #[12000+#4111]=[0.06+#605] #[10000+#4111]=0 /G10 L50 /N8813 R0 /N8812 R0 /G11 /M3 S6000 G91 G17 X0 Y0 G90 G43 Z0.7874 H29 G0 Z0.1969 G1 Z-1.25 F9 G1 G42 X45 G1 Y45 F16 G1 X0 G1 Y0 G1 X45 G1 Y22.5 G1 Y22.75 G1 G40 X49.461 G0 Z0.7874 G0 G49 Z[0.7874+#[11000+#4111]] H0 (END FRE) (RETRACT CUP AND PAUSE) G90 G0 G49 G53 Z0 IF [#609 EQ 1] GOTO 333 IF [#609 EQ 2] GOTO 444 N333 (Y REST POSITION FOR TABLE 1) G53 G0 Y#641 M40 GOTO 113 N444 (Y REST POSITION FOR TABLE 2) G53 G0 Y#643 M52 N113 M05 S0 M0 G90 G0 G49 G53 Z0 G0 M5 IF [#609 EQ 1] GOTO 333 IF [#609 EQ 2] GOTO 444 N333 (REST POSITION FOR TABLE 1) G53 G0 X#640 Y#641 GOTO 113 N444 (REST POSITION FOR TABLE 2) G53 G0 X#642 Y#643 N113 M30 %