586,102 active members*
2,627 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Fadal > basic subroutine question...
Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2009
    Posts
    39

    Red face basic subroutine question...

    How do I use subroutines? we don't have anyone at the shop who is exceptionally proficient on our fadal, but I've been trying to learn it. As I've said in other posts, I don't have a whole lot of general cnc experience, so please explain how to write a subroutine, I'd really appreciate it. Is a subroutine the same as a macro? we've got a 4020 if that make any difference.

  2. #2
    Join Date
    Mar 2003
    Posts
    4826
    Does Fadal list M97 as a valid gcode used for subroutine calls? I'm used to Haas, and that is what Haas uses for subroutines.

    A subroutine is a section of gcode that is placed after the current program's M30. It is placed there so that execution of the main program does not accidentally run through the subroutine. You need a line number on the first line of the subroutine, so that its memory address can be identified from the main program.

    A subprogram is slightly different in that it actually has a unique program number, and is called with M98.

    There is a syntax for identifying the line number (for a subroutine) or a program number (for a subprogram). This can vary a little from one manufacturer to the next. You should be able to find this in the manual.

    Both subroutines and subprograms end with an M99, which the control recognizes as a return back to the main program.

    A macro contains logic statements and variables. You could have a macro within a subroutine or a subprogram, but you would still need to call it with M97/M98 and return from it with M99 for it to be an actual program sub.
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  3. #3
    Join Date
    Jan 2008
    Posts
    89

    subroutine answer

    First assuming that even though it is a Fadal, it has a Fadal control. Our 4020FX has all Fanuc controls and motors.
    A subroutine is "native" to the program usually located at the beginning. A subprogram resides outside of the program as it's own entity until a M98 is called in the "main" prog. A simple example of a subroutine follows
    %
    O0000(CIRC POCKET)
    L100(SUB#)G1 Z-.1 F50.
    L9401(CIRC POCKET CCW FIXED SUBROUTINE)R0+20.(FR)R1+1.(DIA)
    G0 Z.2
    M17(END SUBROUTINE)
    M30(END ALL SUBROUTINES)
    T1 M6(EM)
    G0 G90 M3 S3200 E1 X0 Y0 Z2. G43 H1 M8
    Z.2
    L101(EXECUTE SUBROUTINE 100 1 TIME)
    E2 X0 Y0
    L101


    and so on.......This is just a quick example for cutting pockets.
    You were not asking about "fixed subroutines" like the L9400 L9800 and such correct?

  4. #4
    Join Date
    May 2006
    Posts
    132

    subs

    Hi,

    let's say you want to call subprogram 2 from main program 1

    TA,1
    %
    O0001
    G90 G0 S1000 M3 (AND SO ON)
    G4P3000
    M98P2
    M30

    O0002(TURNS OFF SPINDLE)
    M5
    G4P3000
    M99
    %

  5. #5
    Join Date
    Mar 2009
    Posts
    39
    Quote Originally Posted by sti2011 View Post
    First assuming that even though it is a Fadal, it has a Fadal control.

    You were not asking about "fixed subroutines" like the L9400 L9800 and such correct?
    No, I wasn't. I'm just trying to figure out how to run the machine more efficiently, and try to get it more than just a few of the things it's capable of. Thanks for all of y'alls help. I'm the only other person in our dept. who can turn the machine on, and our other guy is only moderatly proficient, so I appreciate y'all putt'n up with my rookie questions

  6. #6
    Join Date
    Jan 2008
    Posts
    89

    More efficiency for Fadal

    As far as making the machine more efficient the subroutines and sub programs are more a programming "style". They save time initially programming so they help out on that end. If you are using a CAM system then they are really not that important until you end up with a prog that won't fit into the memory. They are great for "fixturing" type progs that are usually done at the control manually.
    For making a Fadal run faster and more efficiently the one most important thing I can recommend is to make sure to turn OFF fead ramps (G8,G9 toggles them) when contouring. Also be sure to set your machine parameters to roll CRC rather than intersectional (This may not be neccessary if you are cam programming)
    In addition use the I,J,K option whenever you are drilling, it is nice to have it native to the machine without having to use a Macro or program long hand and use a sub program or routine to call it.
    Also it never hurts to go to the "books" and maximize feedrates for each tool. Funny thing I've learned is that, the people who actually make the tools sometimes know more than me

  7. #7
    Join Date
    Mar 2009
    Posts
    39
    Quote Originally Posted by sti2011 View Post
    As far as making the machine more efficient the subroutines and sub programs are more a programming "style". They save time initially programming so they help out on that end. If you are using a CAM system then they are really not that important until you end up with a prog that won't fit into the memory. They are great for "fixturing" type progs that are usually done at the control manually.
    For making a Fadal run faster and more efficiently the one most important thing I can recommend is to make sure to turn OFF fead ramps (G8,G9 toggles them) when contouring. Also be sure to set your machine parameters to roll CRC rather than intersectional (This may not be neccessary if you are cam programming)
    In addition use the I,J,K option whenever you are drilling, it is nice to have it native to the machine without having to use a Macro or program long hand and use a sub program or routine to call it.
    Also it never hurts to go to the "books" and maximize feedrates for each tool. Funny thing I've learned is that, the people who actually make the tools sometimes know more than me
    thanks, but you've opened up some other rookie ?'s... what are "feed ramps"? what would they be used for? what do you mean by "roll CRC rather than intersectional"? which books? I know I probably sound like a moron, but we don't have a complete users manual at the shop, tho I've found one on the fadal website. I've tried reading it, but it seems to make good "putyoutosleep" reading... we don't really use CAM, they just give us a print and say "go make it". which is cool in that it's great when you figure it out, but if I write a program with 150-200 lines, it's a "complex" part, and we don't use more than 2 axis at a time, though it would be cool to learn up to 5 axis, but I guess thats inexperience talking... thanks ahead of time, Mason

  8. #8
    Join Date
    Jan 2008
    Posts
    89

    Feed ramps and CRC modes

    As far as feed ramps go a Fadal will upon start and end of a G1 move will slowly build up to the feed rate and slow down at the end. This can create a very "jerky" tool movement even when you doing relatively simple 2 axis contours. If there are no feed ramps, the tool path appears much smoother and it is much faster.
    The difference between roll and int. is if you have a 90 deg corner for instance, in int. the tool path mimmicks the 90 deg corner. In roll the machine looks ahead at the next move and actually turns or "rolls" around the edge in the direction of the next cut. Program a simple square and put a G96 in the beginning of the prog and watch the path, then change it to G97 and look the difference will be pretty clear.
    By the books I mean the tool manufactures recommendation for feeds and speeds. Tools are getting better all the time and speeds and feeds are constantly improving. Especially Lathe work which I also do, it seems there is a new coating or edge prep or whatever every week! And the surface footages can be hundreds of feet different. Hope this helps.......

  9. #9
    Join Date
    Mar 2009
    Posts
    39

    Thanks...

    thanks, that did help alot. I saw what you meant with the CRC, but I can't seem to turn off the feed ramps. I know they're on, and it's frusterating, trying to mill a small hex and I have to turn the feed rate way up to compensate for it. I think I'm having machine problems anyway, it randomly ran away on me recently, into the part, of course, and an M30 at the end of the program sends the Z slamming into the upper stop.... I changed one of the settings to tell it to let the spindle get to full speed before it starts feeding, but I don't see why that would affect the Z at the end of a program... any suggestions?

  10. #10
    Join Date
    Jan 2008
    Posts
    89

    Feed Ramps

    Put a G8 in the prog right after you go to the initial clearance plane. And put a G9 in the prog before you return the Z home.(this will turn off ramps) Fadal progs should end with an M2 not an M30. Also if you just put an M6 or G90 H0 Z0 or tool change to your first tool in the prog it will not + overtravel in Z.
    An example would be...
    G0 Z2. M9 M5
    G90 H0 Z0
    M01
    M2
    %

    OR
    G0 Z2. M9 M5
    T1 M6
    G28(RETURN ALL AXIS HOME)
    M2
    %

Similar Threads

  1. Subroutine question (Cincinnati Milacron Acromatic 850 SX)
    By burnthills in forum G-Code Programing
    Replies: 5
    Last Post: 09-15-2009, 04:34 PM
  2. a very basic fan question.
    By cyclestart in forum CNC Machine Related Electronics
    Replies: 2
    Last Post: 07-07-2008, 12:43 AM
  3. Very Basic Question
    By H2ODiver in forum Uncategorised CAM Discussion
    Replies: 4
    Last Post: 07-27-2007, 02:51 PM
  4. REALLY basic Question
    By Dongle in forum Mechanical Calculations/Engineering Design
    Replies: 25
    Last Post: 03-14-2006, 10:47 PM
  5. Replies: 11
    Last Post: 10-09-2005, 05:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •