Results 1 to 8 of 8

Thread: subprograms

  1. #1
    Registered
    Join Date
    Jan 2008
    Location
    usa
    Posts
    62
    Downloads
    0
    Uploads
    0

    subprograms

    Is there a way to go to a subprogram and have it within the text of your program?

    Like, I was just reading that on a Haas you can...


    O20


    #9=1.
    #101= 2.
    #102=3.
    #103=4.
    #104=5.
    #105=6.

    M97 P100

    M30

    N100
    #9=8.
    #101=7.
    #102=6.
    #103=5.
    #104=4.
    #105=3.
    M99


    which would be sweet.


  2. #2
    Registered dcoupar's Avatar
    Join Date
    Mar 2003
    Location
    USA
    Posts
    2,502
    Downloads
    0
    Uploads
    0
    You don't say what control you want to do this on...


  3. #3
    Registered
    Join Date
    Jan 2008
    Location
    usa
    Posts
    62
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by dcoupar View Post
    You don't say what control you want to do this on...
    Fanuc macro B


  4. #4
    Registered
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    987
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by gravy View Post
    Fanuc macro B
    HAAS use both methods of registering and calling Sub Programs. M98 calls a Sub Program registered as a separate program in the way Fanuc does, and M97 to call a program registered after the M30 in the same program area as the main Program.

    This is not possible directly with a Fanuc Control, but you could emulate the same procedure by using a Macro GOTO_ statement, or M99 P_. In this case, you would use a unique sequence number at the start of the pseudo Sub Program, registered after the M30 in the Fanuc main program, to correspond to the GOTO or P reference. Of course, you would have to provide code at the end of the pseudo Sub Program to return control to the actual Main Program. M99 alone at the end will not function like M99 at the end of an external Sub Program and return control to the block following from whence it was called. You would have to have a GOTO_ or M99 P_ at the end of the routine to return control to the desired location in the Main Program.

    Regards,

    Bill
    Last edited by angelw; 05-25-2012 at 09:22 PM.


  • #5
    Registered
    Join Date
    Jan 2008
    Location
    usa
    Posts
    62
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by angelw View Post
    HAAS use both methods of registering and calling Sub Programs. M98 calls a Sub Program registered as a separate program in the way Fanuc does, and M97 to call a program registered after the M30 in the same program area as the main Program.

    This is not possible directly with a Fanuc Control, but you could emulate the same procedure by using a Macro GOTO_ statement, or M99 P_. In this case, you would use a unique sequence number at the start of the pseudo Sub Program, registered after the M30 in the Fanuc main program, to correspond to the GOTO or P reference. Of course, you would have to provide code at the end of the pseudo Sub Program to return control to the actual Main Program. M99 alone at the end will not function like M99 at the end of an external Sub Program and return control to the block following from whence it was called. You would have to have a GOTO_ or M99 P_ at the end of the routine to return control to the desired location in the Main Program.

    Regards,

    Bill
    Right.

    So I could do...

    #100=1.
    GOTO500
    N1

    M30


    N500
    BLAH BLAH
    GOTO#100

    which is three lines to call instead of one, and each call is unique.

    Drat.

    Thanks much.


  • #6
    Registered
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    987
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by gravy View Post
    Right.

    So I could do...

    #100=1.
    GOTO500
    N1

    M30


    N500
    BLAH BLAH
    GOTO#100

    which is three lines to call instead of one, and each call is unique.

    Drat.

    Thanks much.
    Indeed you could.

    Regards,

    Bill


  • #7
    Registered
    Join Date
    Jul 2010
    Location
    south africa
    Posts
    43
    Downloads
    0
    Uploads
    0

    Talking sub program call , M98Q100L2

    for FANUC control see parm 6005#0 SQC, when =1 you can call a sequence number in the current (main) program.

    i.e. N50 M98Q100L2, the "call" will jump to seq. N100 and repeat 2 times (L)
    N51...


    N100 ..
    ..
    ..
    M99( will return to Line 51)
    ...


  • #8
    Registered
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    987
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by norbert.barnard View Post
    for FANUC control see parm 6005#0 SQC, when =1 you can call a sequence number in the current (main) program.

    i.e. N50 M98Q100L2, the "call" will jump to seq. N100 and repeat 2 times (L)
    N51...


    N100 ..
    ..
    ..
    M99( will return to Line 51)
    ...
    Well that's something I wasn't aware of with a Fanuc control. Thanks Norbert.

    Regards,

    Bill


  • Similar Threads

    1. Subprograms Subroutines Help
      By gibbsmaster in forum EdgeCam
      Replies: 6
      Last Post: 12-22-2012, 06:29 PM
    2. calling subprograms on osp-100
      By horst007 in forum Okuma
      Replies: 8
      Last Post: 11-05-2011, 10:28 AM
    3. Running subprograms from hdd
      By dtmtim in forum Haas Mills
      Replies: 18
      Last Post: 11-22-2010, 10:12 PM
    4. subprograms
      By cnc@gci in forum Mastercam
      Replies: 4
      Last Post: 06-19-2009, 09:42 AM
    5. M97 Internal Subprograms?????
      By CAMCRASH in forum G-Code Programing
      Replies: 6
      Last Post: 03-24-2005, 01:10 PM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.