Hello Guest it is May 14, 2021, 03:12:49 AM

Author Topic: M0 (M00) Issue  (Read 622 times)

0 Members and 1 Guest are viewing this topic.

M0 (M00) Issue
« on: January 03, 2020, 05:21:57 PM »
Hello All,

I am currently looking at options to retrofit my CNC, and as I am considering Mach4, downloaded the demo of Mach4 Hobby.

As I don't want to purchase the hardware until I have evaluated software options, I am using it in sim mode and have hit a snag.

If I place either an M0 or M00 (tried both) anywhere in a g-code file, the toolpath loading hangs when it reads the program stop command. If it is commanded in MDI, the movement stops, but cycle time continues to count, and cycle start does not make it continue.

In either case, after pressing reset, the operation of the GUI then becomes erratic with issues such as homing all axes will only home Z and X then say it is finished or exiting the GUI closes the window but it keeps running in the background.

Am I doing something wrong?

Is this sim related issue, or can I expect it to be the same with a controller attached?

FWIW, the Mach4 build is 4300 32 bit version on 64 bit PC (machine will be 32 bit PC).

Regards, Oz
Re: M0 (M00) Issue
« Reply #1 on: January 04, 2020, 03:36:42 PM »
Hi,
I've been trying to replicate the problem you've described but cannot.

My laptop has an earlier build than yours, 4162.

I loaded a known good Gcode file, a PCB etch file and it loads and draws the toolpath normally.
Then I made a copy of that file but with the addition of several m0 lines interspersed throughout.
It also loads and draws the toolpath normally. When the file runs it stops as expected when it encounters an m0.
The file restarts at <Cycle Start>.

While I use an ESS on my machine, I use Sim(ulator) as active motion control on my laptop.

I recall there was a setting in Mach3 that determined whether M codes were ignored on loading. If there is a similar
setting in Mach4 I cant find it. All I can tell you is that the m0's ARE ignored when loading and drawing the
initial toolpath.

One thing I would like to point out to you, not that I believe it relates directly to your problem, but can and does cause grief
amongst newcomers.

Mach4's Gcode interpreters reduces all uppercase letters to lowercase and strips out leading zeros and whitespace.
G01 X0.88 y42 Z0.001  becomes
g1x.88y42z.001.

In the vast majority of cases Mach will successfully translate what you have written to a string of Gcode that performs
as you expected. There are a few circumstances when it does not......and that can create a real mystery, that can
be devilishly hard to diagnose. May I suggest that you get into the habit of writing Gcode in the exact manner that
Mach expects, it reduces errors. I personally tend to include whitespace in Gcode to make it more human readable
and usually leave a leading zero in a decimal fraction for the same reason.

The time you will notice this feature is if you write your own M codes to replace or take precedence over the built in M code,
m3 for example. There may come a time that you wish when turning on your spindle that you may wish some particular sequence
of events, checking the 'tool in place' circuit for example, and so you will write your own m3 macro. When an m3 macro
is encountered by the Gcode interpreter it searches for the macro starting in your profiles macro folder. If you have written
an M03 macro for instance and Mach is searching for an m3 it may ignore your macro and carry on its search until it finds
the built-in m3 instead.

Craig

My wife left with my best friend...
     and I miss him!

Offline smurph

*
  • *
  •  1,402 1,402
  • "That there... that's an RV."
    • View Profile
Re: M0 (M00) Issue
« Reply #2 on: January 05, 2020, 10:04:29 PM »
Yeah, I can't duplicate this either using build 4360 here internally.  Perhaps you can post the G code that exhibited the issue? 

Steve
Re: M0 (M00) Issue
« Reply #3 on: January 06, 2020, 06:06:00 AM »
Firstly thank you both for your replies...much appreciated.

Below are 2 links to screencasts of the issue, each starting with the G-code not having an M0, then editing and loading with the M0.

https://1drv.ms/v/s!AiHDBQb9cvIthKQMyOOfaSuFTeIpfA?e=TgS7tZ
https://1drv.ms/v/s!AiHDBQb9cvIthKQLHYYk9BjSPWk1dQ?e=B2teuo

I have done 2 so you can see the loading stops relative to where the M0 is in the code.

The code (Start M0) is:
f100.000000
g0x0.000000y0.000000z10.000000
m3 (start Spindle)
s10000
m0
g43h5
g0x0.000000y0.000000z5.00000
g0x0.000000y0.000000z-0.100000
g1x10.000000y10.000000z-0.100000
g1x0.000000y0.0000000z0.000000
m5
g0x0.000000y0.000000z10.000000
m2


@Craig; I usually program with whitespaces also for the same reason (has become habit after 30+ years around CNCs. I admit I did program in Caps initially as I was just modifying the sample program (Roadrunner), but it made no difference going to lowercase.

Regards, Oz
« Last Edit: January 06, 2020, 06:15:37 AM by Ozemale6t9 »
Re: M0 (M00) Issue
« Reply #4 on: January 06, 2020, 11:26:59 AM »
Wasn't there something in the change log about loading g code with M0's...I think it was > v4300?

Offline smurph

*
  • *
  •  1,402 1,402
  • "That there... that's an RV."
    • View Profile
Re: M0 (M00) Issue
« Reply #5 on: January 06, 2020, 08:22:09 PM »
Wasn't there something in the change log about loading g code with M0's...I think it was > v4300?

Damn straight there was! 

"Core: Prevent lock when loading a G code file with M0 in it." 

I wrote that.  I fixed the bug.  And I didn't remember it!!!  My brain is definitely fried. 

So a release from the FTP dev area will fix you up.  Get one later than 4310 just to be sure. 

Back to the lower case stuff.  It is perfectly fine to program your G code in upper case.  Just be aware that the G code interpreter reads a line and the first thing it does is lower case everything.  This is just so we don't have to test for 'G' and 'g', etc..  So internally, everything is lower case.  This means that when programing M code macro scripts the filenames needs to be lower case and the function names inside the file also need to be lower case.  That is what Craig was reffering to.

BTW, You only need to program M code macro scripts if you need something special. 

Steve
Re: M0 (M00) Issue
« Reply #6 on: January 07, 2020, 02:22:57 AM »
Hey, look at that...it works with a later version.

I didn't know these versions existed, as the download link is the version I had.

Installed the latest version I could find from the FTP and voila.

Thanks for your help guys, now I can finish my evaluation and make a decision on which way to go with the retrofit.

...so long as there are no more surprises.

regards, Oz