New option to end a program with % or M2
This commands has the following effects:
Change from Auto mode to MDI mode.
Origin offsets are set to the default (like G54).
Selected plane is set to XY plane (like G17).
Distance mode is set to absolute mode (like G90).
Feed rate mode is set to units per minute (like G94).
Feed and speed overrides are set to ON (like M48).
Cutter compensation is turned off (like G40).
The spindle is stopped (like M5).
The current motion mode is set to feed (like G1).
Coolant is turned off (like M9).
Note
Lines of code after M2/M30 will not be executed. Pressing cycle start will start the program at the beginning of the file.
M2 is a powerful command and in some cases may be just what you want, however depending on your work flow there may be times when you do not want to issue a M2.
For example if you are working in a coordinate system other the G54 and after the sub runs want to execute MDI commands.
Or if you are using a lathe you probably want to stay in the XZ plane(G18) rather than be switched to the XY plane(G17).
Most of us issue the proper commands either in our preamble or in the start of our subs such as...
G18 (XZ plane)
G20 (inches)
G40 (cancel cutter radius compensation)
G49 (cancel tool length offset)
G90 (absolute distance mode)
G94 (units/min feed rate)
G64 p.001 q.001 (set path following tolerance)
So all is well, but if you normally use MDI commands between running subs you may want the machine left as it was set before the sub.
To do this Dewey has added a new option to NGCGUI on Master called nom2.
You set this option as you would all the other NGCGUI options.
With this option your NGCGUI sub will start and stop with a % instead of ending with a M2.
You can still use your post amble to add the commands you wish to execute upon completing such as M5, M9 etc.
Thanks Dewey.
Rick G
Please Log in or Create an account to join the conversation.
By default NGCGUI ends all subs with a M2 (Program End)
This commands has the following effects:
Change from Auto mode to MDI mode.
Origin offsets are set to the default (like G54).
Selected plane is set to XY plane (like G17).
For example if you are working in a coordinate system other the G54 and after the sub runs want to execute MDI commands.
Or if you are using a lathe you probably want to stay in the XZ plane(G18) rather than be switched to the XY plane(G17).
Have you checked if this is actually all true?
I haven't _noticed_ being sent back to G54 and XY on my lathe, but maybe I wouldn't.
Please Log in or Create an account to join the conversation.
JT
Please Log in or Create an account to join the conversation.
Have you checked if this is actually all true?
Naturally. I would not post the information here if I had not checked it out.
Perhaps I should have referenced the quote...
linuxcnc.org/docs/html/gcode/m-code.html#sec:M2-M30
You can confirm on your lathe by...
Start lathe
Touch off in G54
Move to a different location.
Touch off in G55
From MDI issue and watch the display and the active G codes...
G55
G54
G55
G18
M2
Rick G
Please Log in or Create an account to join the conversation.
Naturally. I would not post the information here if I had not checked it out.Have you checked if this is actually all true?
I can vouch for that, it has caused me problems in the past.
I was used to using M30 a lot, because it means rewind on a lot of controllers, not end the program and reset everything.
It is not really noticable until you start using several co-ordinate systems or cutter compensation.
Please Log in or Create an account to join the conversation.
M2 is M2 and M30 is M30 and % is just the end. It's nice that NGCGUI offers the option. It might be worth there being a very explicit section in the manual on the different ways to end a program. (Or, if it already exists, can I have the link because this is all a bit of a surprise to me. I probably need to spend more time actually making stuff)
Please Log in or Create an account to join the conversation.
It is briefly mentioned here...
linuxcnc.org/docs/html/gcode/overview.html#_overview
But it does not really go into the differences, I agree more detail might be nice.
I have gotten into the practice of using % at the start and end because of some of the unwanted effects (for me at times) of M2.
I do like to use M2 at the end of the day or when shutting down.
The point is of course that now we have the option with NGCGUI.
Rick G
Please Log in or Create an account to join the conversation.
JT
Please Log in or Create an account to join the conversation.
- somenewguy
- Offline
- Senior Member
- Posts: 44
- Thank you received: 0
can NGCGUI be configured to ask for any arbritary M code? Sounds like no but I haven't looked. maybe those of us with special needs or strange workflow would be well served to modify M2 or create our own custom M code to end NGCGUI files with.
Please Log in or Create an account to join the conversation.
- somenewguy
- Offline
- Senior Member
- Posts: 44
- Thank you received: 0
more than a little vauge for the n00bs like myself. Someone illuminated this a bit for me on IRC a few weeks back, but I have completly forgotten what I learned at this point. fortunatly I took notes, but they are not in front of me.
Please Log in or Create an account to join the conversation.