M97 local sub. keeps looping


Results 1 to 3 of 3

Thread: M97 local sub. keeps looping

  1. #1
    Registered
    Join Date
    Aug 2016
    Location
    Canada
    Posts
    3
    Downloads
    0
    Uploads
    0

    Question M97 local sub. keeps looping

    I'm starting to experiment with programming multiple work offsets using the M97 on my Haas OM2 and I keep getting stuck on my first sub program. It's probably just a matter of my syntax being slightly off:

    O10001(Base modification)
    G20 G90 G40
    T01 M06 (0.03" EM)
    G54
    S10000 M3
    G0 X0.2889 Y-0.1071
    G43 H01 Z1.
    M97 P12000
    /G55
    /M97 P12000
    /G56
    /M97 P12000
    /G57
    /M97 P12000
    /G58
    /M97 P12000
    /G59
    Z1.

    N12000
    ... (insert sub here)
    G0 Z1.
    M99

    G28 Z0 M5
    M9
    M01

    T02 M06 (0.01" EM)
    ...
    (N13000 on 6 locations to follow with 2nd tool)

    I think my problem lies in the placement of the M99, but I've tried switching it with an M02, and moving it within and outside of the sub. and it doesn't seem to make any difference. The machine just keeps looping back to G54 indefinitely.

    Any suggestions how I can continue to the G28 block would be much appreciated

    Similar Threads:
    Last edited by smegma; 08-22-2018 at 01:53 PM. Reason: Needed to elaborate on code for the second tool


  2. #2
    Registered Fletch_CNC's Avatar
    Join Date
    Jun 2015
    Location
    United States
    Posts
    119
    Downloads
    0
    Uploads
    0

    Default Re: M97 local sub. keeps looping

    Quote Originally Posted by smegma View Post
    /G59
    Z1.

    N12000
    ... (insert sub here)
    G0 Z1.
    M99

    G28 Z0 M5
    M9
    M01

    T02 M06 (0.01" EM)
    ...
    (N13000 on 6 locations to follow with 2nd tool)

    Unless you edited this to shorten the post, you need something like an M30 or a GOTO between the the Z1. line and the N12000 line, or it is just going to keep running the "subprogram" as an inline part of the main program. Since in that instance the M99 is not returning anywhere (as it would if there was an M97 or G65 call that sent the program to a subprogram), it will just jump to the head of the program (and loop endlessly).

    ________________________________________________
    My blog: http://www.fletch1.com


  3. #3
    Member
    Join Date
    Feb 2011
    Location
    usa
    Posts
    353
    Downloads
    2
    Uploads
    0

    Default Re: M97 local sub. keeps looping

    Fletch said it above




    O10001(Base modification)
    G20 G90 G40
    T01 M06 (0.03" EM)
    G54
    S10000 M3
    G0 X0.2889 Y-0.1071
    G43 H01 Z1.
    M97 P12000
    /G55
    /M97 P12000
    /G56
    /M97 P12000
    /G57
    /M97 P12000
    /G58
    /M97 P12000
    /G59
    Z1.
    G28 Z0 M5
    M9
    M01

    T02 M06 (0.01" EM)


    (end of tool call outs)
    M30(Place the m30 between tool call outs and sub routines)
    Your example above says to goto n12000 return to just after first m97 call then with the block deletes active it runs N12000 and return to the beginning of the program and start again


    N12000
    ... (insert sub here)
    G0 Z1.
    M99
    %



Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

M97 local sub. keeps looping

M97 local sub. keeps looping