M30 – End The Program And Rewind
This command ends the program and moves back to the first line of the gcode file.
Syntax & Parameters
- M30
- L Value When added to the M30 command causes the program to be repeated for the specified number of cycles. L10 will run the Gcode 10 times before rewinding stopping
- L0 Value When L0 is added to M30 the Program will rewind and repeat on an infinite loop.
INFORMATION: When a Gcode file loops the spindle does not stop on the M30 until the last cycle. This eliminates Spin up and spin down time between cycles.
Example program
N10 G00 X0 Y0 N20 G00 X10 N30 M30 N40 G00 Y10
- The N10 line will move both X and Y axis to 0.00 position.
- In line N20 the X axis will move to X 10 position.
- In line N30 the program will stop and the file will rewind back to line N10, pressing cycle start will start the program from N10 line.
Infinite Loop
N10 G00 X0 Y0 N20 G00 X10 N30 M30 L0
- This program executes lines N10 to N30 before rewinding back to N10 and starting again automatically. It will continue until it is manually stopped.
Repeat 20 times
N10 G00 X0 Y0 N20 G00 X10 N30 M30 L20
- This program executes lines N10 to N30 before rewinding back to N10 and starting again until it has completed 20 cycles at which time it will rewind to N10 and stop.