Challenge - 5 Problems
Subprogram Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediateWhat does this CNC program output when calling subprogram with M98?
Consider the following CNC program snippet. What will be the final position of the tool after execution?
CNC Programming
N10 G00 X0 Y0 N20 M98 P100 L2 N30 G01 X50 Y50 F100 N40 M30 O100 N10 G01 X10 Y10 F50 N20 M99
Attempts:
2 left
💡 Hint
Remember M98 calls the subprogram multiple times, and M99 returns control to the main program.
✗ Incorrect
M98 calls subprogram O100 twice (L2). Each call moves the tool to X10 Y10. After returning, the main program moves the tool to X50 Y50. So final position is X50 Y50.
🧠 Conceptual
intermediateWhat is the role of M99 in CNC subprograms?
In CNC programming, what does the M99 command do inside a subprogram?
Attempts:
2 left
💡 Hint
Think about how the program flow returns after a subprogram finishes.
✗ Incorrect
M99 signals the end of a subprogram and returns control to the main program at the point after the M98 call.
🔧 Debug
advancedIdentify the error in this CNC subprogram usage
What error will occur when running this CNC code snippet?
CNC Programming
N10 G00 X0 Y0 N20 M99 N30 G01 X100 Y100 F200 N40 M30
Attempts:
2 left
💡 Hint
M99 should only be used inside subprograms.
✗ Incorrect
M99 is a return command and must be inside a subprogram. Using it in the main program causes a syntax error.
🚀 Application
advancedHow many times will the subprogram run?
Given this CNC program, how many times does the subprogram O200 execute?
CNC Programming
N10 G00 X0 Y0 N20 M98 P200 L3 N30 G01 X100 Y100 F150 N40 M30 O200 N10 G01 X20 Y20 F100 N20 M99
Attempts:
2 left
💡 Hint
L parameter in M98 specifies the number of repetitions.
✗ Incorrect
M98 P200 L3 calls subprogram O200 three times before continuing the main program.
🧠 Conceptual
expertWhat happens if M99 is missing in a subprogram called by M98?
If a subprogram called with M98 does not contain an M99 command, what is the expected behavior?
Attempts:
2 left
💡 Hint
Think about how the program flow ends if no explicit return is given.
✗ Incorrect
Without M99, the subprogram runs until it reaches M30 or the program end, effectively ending the entire program or stopping execution.
