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 ?
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 ?
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.
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.
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.
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
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.
Xylotex only refers to the motors/drives apparently? What software is controlling all this on the PC?
Capris, using Mach3
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).
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.
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.
I do similar to post#9 and in the sub program I quite often incremnt some variable, like this:
G52 X0 Y0 Z0 (forget any I might have done before)
#666=0 (START POINT)
#667=-20 (INCREMENT TO NEXT PATTERN)
M98 P1000 L5
G52 X0 (FORGET THE OFFSET)
etc
(I WANT TO MANUALLY START PROGRAM HERE and use #666)
(#666 should be -75 after run from here)
(Second process using #666)
etc
M30
(--- end of program)
(subroutines)
O1000 Code being repeated
N333 G52 X#666 (NEW X offset for this pattern)
etc (the pattern starting at X0 first time, then X-15 ... X-60)
etc
#666=#666+#667 (NEXT X OFFSET)
M99
This all works and runs to the end correctly.
The problem I have is that if I wish to run part of the program
from N333, by moving down through the code window to the start line N333, Hit set line, then run from here, while the program does it's dummy runs it does not loop through the subroutine 5 times, so when the program is ready to start at N333 the value in #666 is only #667. The rapid stepping after hitting run from here does not honor the L5.
If I know I am going to want to do some intermediate starts, I make a hole heap of inline code with cut and paste.
Does anybody know how to make this work properly?
Can you put conditional coding in line in Mach3?
Super X3. 3600rpm. Sheridan 6"x24" Lathe + more. Three ways to fix things: The right way, the other way, and maybe your way, which is possibly a faster wrong way.
Ok, guys, here is a problem to resolve. When I use M98 to execute a pattern L5 times, it executes the first one with no problem, when it returns to the top to execute the second thru 5th iteration, it slows down to a crawl contrary to the speed settings that I so carefully set. Would anyone have any ideas why this is happening?
Larry
W4LML 20mtrs
Perhaps you've used an "inches/mm per minute" code near the end of the repeated section, and forgotten to re-instate "inches/mm per revolution" at the beginning of the code. .005 inches per minute is darn slow.