Page 1 of 2 12 LastLast
Results 1 to 12 of 15

Thread: whole G-Code REPEAT command ??

  1. #1
    Registered
    Join Date
    Sep 2007
    Location
    US
    Posts
    150
    Downloads
    0
    Uploads
    0

    whole G-Code REPEAT command ??

    seems simple but have been searching everywhere to no avail...

    is the a g-code command that simply restarts proccessing at the beginning of the code?

    or just repeat the code ?


  2. #2
    Registered
    Join Date
    Jul 2005
    Location
    Canada
    Posts
    11,960
    Downloads
    0
    Uploads
    0
    I think what you can use depends on your controller.

    Sometimes if you end a program with M99 the controller will go back and start at the top, and do this endlessly; some controllers will give an alarm telling you it is an endless loop.

    The best way in my opinion is just put the code to be repeated in a subroutine and then use an L count in the subroutine call;

    etc
    etc
    M97 P1000 L5
    etc
    etc
    M30
    N1000 Code being repeated
    etc
    etc
    M99

    You can simply repeat the section of code. I program on Haas and it is so easy to duplicate blocks of code I will do this when I am feeling too lazy to set up the subroutine format. But if you simply repeat the block of code many times then want to edit it you have many places to edit; with the subroutine approach you edit at one place.
    An open mind is a virtue...so long as all the common sense has not leaked out.


  3. #3
    Registered beege's Avatar
    Join Date
    Feb 2008
    Location
    USA
    Posts
    546
    Downloads
    0
    Uploads
    0
    Since G codes don't have anything to do with "tape function", probably you would need an M code, like M99. You might be able to use a WHILE/DO loop, or an IF/GOTO or a straight GOTO statement. The M98 subprogram call would work for L times, but it wouldn't be an endless loop. The only G code might be a G65 macro call that would refer to a program that had M99P10 at the end (where 10 is the line number just before that macro call). Then you'd also be stuck in a loop. Of course it does depend on which control you are using.


  4. #4
    Registered
    Join Date
    Jul 2007
    Location
    USA
    Posts
    195
    Downloads
    0
    Uploads
    0
    M30 is rewind back to start of program. But you have to hit the big green button again to start the program again.
    Be carefull what you wish for, you might get it.


  • #5
    Registered
    Join Date
    Sep 2007
    Location
    US
    Posts
    150
    Downloads
    0
    Uploads
    0
    Thx for the info....Beege the M98 sounds simple since I dont actually need it to be endless. so it would just be (M98 #) where # = numer of repeats?

    btw, the controller is a xylotex and yes Geof its pulling an alarm with M99


  • #6
    Gold Member
    Join Date
    Oct 2005
    Location
    USA
    Posts
    672
    Downloads
    0
    Uploads
    0
    Typically, the M98 calls the subprogram/subroutine.

    On my Mitsubishi controls, the format is:

    M98 Pppp Hhhh Ll

    ppp=external subprogram number (omit if subroutine is at end of current program)
    hhh= line number of the subroutine
    l= number of times to repeat

    The subroutine would start at line hhh and the signal to finish and return the original block is M99.

    Some machines have proprietary loop/repeat codes.


  • #7
    Gold Member
    Join Date
    Oct 2005
    Location
    USA
    Posts
    672
    Downloads
    0
    Uploads
    0
    Xylotex only refers to the motors/drives apparently? What software is controlling all this on the PC?


  • #8
    Registered
    Join Date
    Sep 2007
    Location
    US
    Posts
    150
    Downloads
    0
    Uploads
    0
    Capris, using Mach3


  • #9
    Gold Member
    Join Date
    Oct 2005
    Location
    USA
    Posts
    672
    Downloads
    0
    Uploads
    0
    According to the Mach3 website, Geof's code above is close except he has M97 instead of M98 and instead of using "N1000" it should be O1000. Note that O1000 starts with the letter "O", not the numeral zero.

    Plagarizing Geof:

    etc
    etc
    M98 P1000 L5
    etc
    etc
    M30
    O1000 Code being repeated
    etc
    etc
    M99


    According to the Mach3 website, line O1000 cannot contain anything other than a comment (sub 1000, for example).

    I get all that from http://www.machsupport.com/docs/Mach3Mill_1.84.pdf looking at page 138 of 157 of the PDF file (10-34 in Mach3 pages).


  • #10
    Registered
    Join Date
    Jul 2005
    Location
    Canada
    Posts
    11,960
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Caprirs View Post
    ....Plagarizing Geof:...
    Imitation; the most sincere form of flattery. Thank you.

    The M97/M98 thing is why I have learnt to put the comment about it depending on your controller.

    I program on Haas and use M97 which is an internal subroutine call, M98 jumps you out to a different program. Does Mach use M98 as an internal call requiring the M99 return?
    An open mind is a virtue...so long as all the common sense has not leaked out.


  • #11
    Gold Member
    Join Date
    Oct 2005
    Location
    USA
    Posts
    672
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Geof View Post
    Imitation; the most sincere form of flattery. Thank you.

    The M97/M98 thing is why I have learnt to put the comment about it depending on your controller.

    I program on Haas and use M97 which is an internal subroutine call, M98 jumps you out to a different program. Does Mach use M98 as an internal call requiring the M99 return?
    Is stealing really the same as imitation?

    On my Mitsubishi machines, there is no M97. M98 is the only available command.

    M98 P H L I J

    P = external program number. If no P is specified, the control searches within the current program.

    H = line number. I don't know why Mits uses H instead of N. If going to an external program P, no H is required.

    L = repeat. Number of times to repeat the sub. If no L specified, the sub is executed once.

    I, J = allow for rotation of the sub as it is repeated. For example, making a gear involves the code for single tooth that is repeated enough times to rotate the 360 degrees.


  • #12
    Registered
    Join Date
    Jul 2005
    Location
    Canada
    Posts
    11,960
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Caprirs View Post
    Is stealing really the same as imitation? .....
    Go on, cut me some slack

    That rotation feature looks handy. Haas does it a different way.
    An open mind is a virtue...so long as all the common sense has not leaked out.


  • Page 1 of 2 12 LastLast

    Similar Threads

    1. g code for repeat the previous move
      By woffler in forum G-Code Programing
      Replies: 6
      Last Post: 03-26-2008, 11:07 PM
    2. How Do I Repeat?
      By TZ250 in forum Dolphin CADCAM
      Replies: 2
      Last Post: 03-04-2008, 06:11 AM
    3. Repeat command on TL-1?
      By Haeusser in forum Haas Lathes
      Replies: 4
      Last Post: 07-31-2007, 06:31 PM
    4. Need help on G75.1 pattern repeat
      By wayne mitchell in forum G-Code Programing
      Replies: 1
      Last Post: 03-16-2005, 03:49 PM
    5. Repeat g-code with y offset
      By tpaulson in forum G-Code Programing
      Replies: 19
      Last Post: 11-29-2004, 02:36 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.