New option to end a program with % or M2

More
30 Aug 2013 17:34 #38242 by Rick G
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).

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.

More
31 Aug 2013 05:35 - 31 Aug 2013 06:08 #38271 by andypugh

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.
Last edit: 31 Aug 2013 06:08 by andypugh.

Please Log in or Create an account to join the conversation.

More
31 Aug 2013 19:14 - 31 Aug 2013 19:17 #38303 by BigJohnT
Rick's quote is from the manual so it has to be true...

JT
Last edit: 31 Aug 2013 19:17 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
31 Aug 2013 20:17 #38305 by Rick G

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.

More
31 Aug 2013 21:19 #38310 by ArcEye

Have you checked if this is actually all true?

Naturally. I would not post the information here if I had not checked it out.


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.

More
01 Sep 2013 09:44 #38340 by andypugh
Sorry chaps, I think I failed to notice which section this was in (the perils of trying to read all of the forum). (I don't like the forum format for things I want to know I have read all of).
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.

More
01 Sep 2013 17:41 - 01 Sep 2013 17:42 #38357 by Rick G
Andy,

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
Last edit: 01 Sep 2013 17:42 by Rick G.

Please Log in or Create an account to join the conversation.

More
01 Sep 2013 23:02 #38369 by BigJohnT
I think there should be a section after the overview called "Format of a File" and move most of the overview into that section with a link from M2-M30 to that section as well.

JT

Please Log in or Create an account to join the conversation.

More
03 Jan 2014 00:51 #42294 by somenewguy
agreed. I think it would serve a lot of purposes to have a "gcode for dummies" into on the wiki somewhere that very very briefly mentions all the fundamental parts of good g-code, with each mention linking out to a very thurough explination of each. the detailed info already exists, it is a good summary we seem to be missing.

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.

More
03 Jan 2014 00:59 #42296 by somenewguy
linuxcnc.org/docs/html/gcode/m-code.html#sec:M2-M30

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.

Time to create page: 0.323 seconds
Powered by Kunena Forum