New option to end a program with % or M2

More
03 Jan 2014 15:40 #42310 by Rick G
You can use a postamble (such as bye.ngc) as well as a preamble with ngcgui, perhaps that will do what you want.

Rick G

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

More
04 Jan 2014 10:46 #42342 by somenewguy

You can use a postamble (such as bye.ngc) as well as a preamble with ngcgui, perhaps that will do what you want.

Rick G


that is super obvious, can't belive I didn't think of it. a % in the preamble and post will net what I want without use of an M2 it seems. Also to note in the past I got hte "this code doesn't end wit ha % or m2" error message, and since I had learend M2 wasn't what I wanted I tried using a % and iirc it still failed and I never understood why. The docs claim you need a % at the begging and end, but I think the error message will say you are lacking a % at the end of your code even if you ONLY have a % at the end. Obviously "begggining" and "end" are non-trivial things for a PC to recognize, but clear to me. Eitherway I was never aware the %s had to wrap your code due to the vague error messages.

but all of that is from memory, I'll see if I can replicate it or if it was just my greeen showing.

On the topic at hand, does a % sign simply tell the interperter "this code is complete enough to execute" and send zero commands to the machine itself? Want to understand exactly what it does, can't find anything in the documents so far.

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

More
04 Jan 2014 17:00 #42348 by Rick G
There seems to be more documentation on M2. And if you look that up you can see exactly what it does.
The idea is that % will just stop the program without all those unwanted changes.
Keep in mind you will have to use the NOM2 option or edit the resulting ngcgui sub before running it it use the % or ngcgui will add a M2 to the end and the % need to be at the beginning.

Rick G

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

More
05 Jan 2014 15:24 #42369 by somenewguy
ok so you are confirming % does nothing more than end a program?

I am not sure what you mean by NOM2 option, also I can't find the postamble that is being applied to my subs. I see the default preamble std-in.ngc, but there is a single line w/ two comments being appended to the file wit hthe M2 and I don't know where or how to configure that.

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

More
05 Jan 2014 20:09 - 05 Jan 2014 20:26 #42370 by Rick G

I can't find the postamble that is being applied to my subs. I see the default preamble std-in.ngc, but there is a single line w/ two comments being appended to the file wit hthe M2

If you did not select a postamble then none is being used, the M2 is doing everything.

M2 does the following

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).


There is a bit of info here...
linuxcnc.org/docs/html/gcode/overview.html

It is my understanding that if you start with a % and end with a % the last % is just that, end the program. So I am sure to apply a M5 (spindle off) before ending the program an not relying on the end of program or M2 to turn the spindle off.
You can still use a M2 in a program that starts and ends with % however M2 ends the program at the M2 point and noting is read beyond it.

NOM2 is an option for the latest version of ngcgui. Probably only available as a patch or on Master. The default behaviour is for ngcgui to end all subs with a M2, if you select this option then all subs start and end with % and M2 is not automatically added to the end.
To see this create a sub and instead of auto sending it to linuxcnc save it to a file. You can then edit that file before running it to experiment.

Rick G
Last edit: 05 Jan 2014 20:26 by Rick G.
The following user(s) said Thank You: somenewguy

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

More
06 Jan 2014 06:10 #42374 by somenewguy
ok I think I will continue to sit on 2.5.3, and wait for 2.5.4 to be released as I assume it will give me the updated ngcgui. I can manually remove the M2 for now and start using a postamble. I thought single line being added WAS from a post amble file that only had that one line. Wrong on that count. Traveling for work soon, the day before I leave I am pulling my controller out and shipping it off for a repair, none of my digital outputs work anymore... Of course it will probably be cheaper to just buy a new board and have 2. Then I will actually care about spindle control, currently there is just al light switch involved. Everything is wired for control but not very usefull without digital out...

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

More
06 Jan 2014 07:21 #42378 by andypugh

ok I think I will continue to sit on 2.5.3, and wait for 2.5.4 to be released.


Might be a long wait, I think the next release will be 2.6 :-)

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

More
06 Jan 2014 14:47 #42382 by Rick G
Glad you are getting it sorted out.


Rick G

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

Time to create page: 0.788 seconds
Powered by Kunena Forum