M30 – End The Program And Rewind
M30 ends the program and rewinds to the first line of the G-code file. Add L to repeat the program a set number of times, or forever.
Syntax
M30 L__
After M30
Rewinds to line 1
L0
Infinite loop
1. Parameters
INFORMATION
When a program loops, the spindle doesn't stop at M30 until the final cycle, so there's no spin-down and spin-up time between cycles.2. Examples
End and rewind
N10 G00 X0 Y0 N20 G00 X10 N30 M30 N40 G00 Y10
Infinite loop
N10 G00 X0 Y0 N20 G00 X10 N30 M30 L0
Runs N10 to N30, rewinds to N10 and starts again automatically, until stopped manually.
Repeat 20 times
N10 G00 X0 Y0 N20 G00 X10 N30 M30 L20
Runs N10 to N30 and repeats until 20 cycles are complete. After the last cycle it rewinds to N10 and stops.