587,303 active members*
3,316 visitors online*
Register for free
Login
Results 1 to 16 of 16
  1. #1
    Join Date
    Nov 2008
    Posts
    21

    Unhappy Subroutine and Absolute/Incremental

    Hey everybody.
    My company has a Haas VF2SS and I'm new to g-code and am wondering how to use a subroutine on a mill patern.

    I'm trying to write a code for one mill patern about the origin and then move the mill patern using subroutines to 3 locations.

    My question is:
    How do I write the code? Absolute or Incremental?

    Right now I have it writen in Absolute and I'm trying to move the subroutine in absoulte.
    Something like this:

    G00 G55 G90 X-1. Y0;
    M97 P1000;
    G00 G55 G90 X-.2 Y0;
    M97 P1000;
    G00 G55 G90 X.9 Y0;
    M97 P1000;
    M30;

    N1000;
    G00 G91 X0 Y0;
    G00 Z.25;
    G01 Z-.25 F10.;
    G01 X-1. Y-2. F20.;
    G02 X1. R1.;
    G01 Y2.;
    G02 X-1. R1.;
    G01 Y-2.;
    G01 Z.25 F100.;
    M99;

    Do I need to rewrite this Subroutine in Incremental?

    Thanks in advance for your help!
    jettawagonautocross.blogspot.com

  2. #2
    Join Date
    Mar 2003
    Posts
    4826
    Easiest way is to use a unique workshift for each location. Run the first part at G54, second one at G55, third at G56.

    This makes it easy to adjust the datum of each pattern simply by studying the values in the offset register and adjusting the X and/or Y values to reflect how far the patterns are from each other.

    You might also research the usage of G52, as this permits setting a datum at any point you like, then jumping to a subroutine written in absolute and the absolute code will regard the G52 as the absolute zero until it is cancelled. I call that an advanced technique because I have not used it myself yet
    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
    Jul 2005
    Posts
    12177
    Write it in absolute and either use three work zeroes, G54, G55, G56 each located for the positions of three parts as Hu suggests or use G52 also as Hu suggests. It is six of one half a dozen of the other really; G52 sets a supplementary work zero with reference to your main work zero.

    EDIT: Hu's reply wasn't there when I clicked on REPLY; obviously great minds think alike.
    An open mind is a virtue...so long as all the common sense has not leaked out.

  4. #4
    Join Date
    Nov 2008
    Posts
    21
    Thanks for the sppedy Sunday replies!!!

    In the back of my head I was thinking I should use the different work coords.

    I'll try that now and let ya know.
    jettawagonautocross.blogspot.com

  5. #5
    Join Date
    Mar 2005
    Posts
    988
    On the flip side ,... there's nothing wrong with your original thought process of using an incremental sub either. You can simply position your pattern where ever you want based on one work offset. You don't need to keep calling the workoffset either. And you still maintain the same adjustability as G52 or other methods...

    There are a number of ways to accomplish the same task... Hu's offset method allows to adjust from Work offset page. The others are updated by positioning in the program.. You can also set your positions to variables and simulate Work offset page function but that may be 'advanced' for now as well....
    It's just a part..... cutter still goes round and round....

  6. #6
    Join Date
    Nov 2008
    Posts
    21
    YES!!! That worked!!! I used G55 as the center of my part. In MDI, I moved over the distances to the center of each patern and called them G56, G57 and G58 respectivly in OFFSETS and ran the program in the GRAPHICS screen. It looks great!

    Thanks again for your help!
    Allan
    jettawagonautocross.blogspot.com

  7. #7
    Join Date
    Nov 2007
    Posts
    79
    hi all , i just wonder about the sub rotine start (M97) ???
    in the program that vw bmx already written!!!!!
    as i know it should be M98 to call sub program , if there is another code (M code ) to call sub programme pls let me know
    thnx all

  8. #8
    Join Date
    Apr 2006
    Posts
    133

    M97 Local Sub

    The M97 is a local Sub Routine call. The local sub is included in the main program and is located after the M30 and before the % at the end of the program file and always ends with a M99
    In "M97 P1000" the P1000 is the first line number of the Sub as in VWbmx's example. This may be a Haas only feature. I don't know if Fanuc controls use local subs.

    I like to use G97 local subs because all the code for a part is included in one file. It makes backup a lot easier.

  9. #9
    Join Date
    Jul 2005
    Posts
    12177
    Quote Originally Posted by nabil_elbadri View Post
    hi all , i just wonder about the sub rotine start (M97) ???
    in the program that vw bmx already written!!!!!
    as i know it should be M98 to call sub program ....
    It's a Haas thing. Very convenient as mentioned above you have all the code in one file. Haas also allows almost unlimited nesting of subroutines.
    An open mind is a virtue...so long as all the common sense has not leaked out.

  10. #10
    Join Date
    Mar 2005
    Posts
    988
    The M97 is a local Sub Routine call......This may be a Haas only feature. I don't know if Fanuc controls use local subs.
    FANUC = NO
    YASNAC = YES
    MAZATROL = YES
    MITSUBISHI = YES

    OTHERS= ???

    Although it's not M97 on the other controls but the way it works is all the same...
    It's just a part..... cutter still goes round and round....

  11. #11
    Join Date
    Feb 2009
    Posts
    3
    im studying programming and just wondered how sub routine G97 for hass worked with rgards to drilling, i center drill, drill and ream several different holes. is this possible in sub-routine, if so how would it be inputted?

    regards

  12. #12
    Join Date
    Jul 2005
    Posts
    12177
    I seem to recall I used M97 (I think this is what you mean but you typed G97) in a drill canned cycle.

    I was spotting, drilling and tapping and had all the hole coordinates in a subroutine which I called after setting up the canned cycle.

    I will play with one of my machines and see if it works I could be remembering it incorrectly.

    EDIT: Yes it works here is how to set up the program (with some stuff missing of course).

    Blah
    Blah
    Spot Drill
    G82 Z-.2 F? R? L0
    M97 P1000
    G80
    Blah
    Blah
    Drill
    G83 Z-2. Q? F? R? L0
    M97 P1000
    G80
    Blah
    Blah
    Tap
    G84 Z-.2 F? R? L0
    M97 P1000
    G80
    Blah
    Blah
    M30
    N1000 All the hole coordinates
    M99

    Some things to note:

    The L0 in the canned cycle command means that the machine does not perform the cycle until it reads the first set of coordinates in the subroutine.

    SETTING 28; CAN CYCLE ACT W/O X/Y has to be turned ON so you can omit the X and Y coordinates in the canned cycle line.
    An open mind is a virtue...so long as all the common sense has not leaked out.

  13. #13
    Join Date
    Feb 2009
    Posts
    3
    thanks, i am trying to get my head round it, im looking at the hass booklet, what is confusing me the most is the z axis alterations.

  14. #14
    Join Date
    Jul 2005
    Posts
    12177
    Quote Originally Posted by COOLSKODA View Post
    thanks, i am trying to get my head round it, im looking at the hass booklet, what is confusing me the most is the z axis alterations.
    Do you mean the ability to change Z in the list of coordinates?

    This is possible on a Haas; you can drill to different depths at each location like this:

    X-1. Y-1. Z-1.5
    X-2. Y-1. Z-0.5
    X-3. Y-1. Z-2.5
    X-4. Y-1. Z-1.5
    X-5. Y-1.
    X-6. Y-1.
    X-7. Y-1.

    The last three holes will all be Z-1.5 because that is the last read Z depth. You could also omit the Y-1. if the Y coordinate does not change.

    You can also change the work coordinate: You may want to repeat the hole pattern at several locations so you set up the canned cycle like my example and go to the subroutine and then change the work coordinate and go back

    G54
    Canned cycle
    M97 P1000
    G55 M97 P1000
    G56 M97 P1000
    G57 M97 P1000
    etc
    G80
    An open mind is a virtue...so long as all the common sense has not leaked out.

  15. #15
    Join Date
    Feb 2009
    Posts
    3
    thanks again, i have done it the work co-ordinate way, what you have just explained as backed up what i have done.

    i am also struggle with g150 (general purpose pocket milling) again i am looking at the hass manual, and for the pocket a sub-program i used, but i can't see an m97 in their example, why is a sub-program needed?

    regards

  16. #16
    Join Date
    Jul 2005
    Posts
    12177
    Quote Originally Posted by COOLSKODA View Post
    ....i am also struggle with g150 (general purpose pocket milling) .... why is a sub-program needed?

    regards
    Because Haas says so.

    That is one of the things you just gotta do; the pocket coordinates have to be in a separate program.

    I think the G150 line is actually a macro call to a hidden macro, and inside this macro there is probably the M98 that calls the pocket coordinate program.
    An open mind is a virtue...so long as all the common sense has not leaked out.

Similar Threads

  1. Example of a Subroutine?
    By donl517 in forum Fadal
    Replies: 14
    Last Post: 06-27-2007, 04:05 PM
  2. Offsets: Changing between absolute and incremental
    By MotorCityMinion in forum Haas Mills
    Replies: 11
    Last Post: 03-04-2007, 05:57 PM
  3. Absolute or Incremental
    By mikede in forum Haas Mills
    Replies: 1
    Last Post: 02-04-2007, 12:02 AM
  4. Need help with subroutine
    By 2_jammer in forum Uncategorised CAM Discussion
    Replies: 1
    Last Post: 01-18-2005, 05:46 AM
  5. Absolute and Incremental
    By ACME in forum G-Code Programing
    Replies: 3
    Last Post: 09-04-2004, 11:45 PM

Posting Permissions

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