Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: smav on April 04, 2018, 12:03:55 PM

Title: Mach 4 stops processing gcode
Post by: smav on April 04, 2018, 12:03:55 PM
If anyone has seen this or has any ideas of what to look for I would appreciate their suggestions/input:

ISSUE: Yesterday while turning an object on my 4 axis cnc, the machine and program stopped and about 50 lines from the end of the code. Total length of code was about 1350 lines. It stopped on an axis move and all commands before and after were all just axis movements. I was able to get the rest of the program to execute by selecting the Single Block function and then clicking the cycle start to complete the project one line at a time. It reported no errors and the line of code it stopped on did not appear to have any syntax errors or be any different from the previous lines of codes. Also the last two lines of code are an M5 spindle stop and honestly don't remember the very last it may have been a go to home coordinate command but after  at the last move of the axis I had to actually click in the window on the M5 command and then hit cycle start twice to get it to complete the last two lines of the code.
Thanks for reading.....
Title: Re: Mach 4 stops processing gcode
Post by: joeaverage on April 05, 2018, 01:26:13 AM
Hi,
is your copy of Mach4 licenced? If its still in demo mode it will run for a fixed length of time and then stop, usually about 6 minutes.

You can see Machs licence status at the Help/About tab.

Craig
Title: Re: Mach 4 stops processing gcode
Post by: smav on April 05, 2018, 11:31:04 AM
I am pretty sure it is. I bought it, a few weeks back, as part of a bundle with a PMDX control card and went through the licensing procedure that was emailed to me. I have done some other projects which exceeded 6 minutes and by the time it gets to that line of code in the one I was running it was well past the 6 minute mark. I will check the Help tab to make sure it does reflect it as being licensed to make sure I didn't miss something.
Title: Re: Mach 4 stops processing gcode
Post by: smav on April 06, 2018, 11:43:32 AM
Checked the licence information yesterday, it appears to be present and correctly displaying as a licensed version. I noticed yesterday while running a different gcode program that it may be actually reading ahead and hanging on a G92 command later in the program. I have modified my mach 4 to have some scaling DROs and while running the particular code that I have the problem with I also had the z axis scaled back by 50% on the first pass. I had a typo in another program that I was running and it stopped and reported that there was an unrecognized word. I looked at the code on the screen and it all was correct but when I scrolled down several lines I noticed the error in the code and corrected it, after which the code ran as designed. Is there any real advantage to having the read ahead option turned on? I believe I saw it set at 20 lines when I was going through setting up the software and I did not change it from it's default setting during my initial setup.
Thanks........
 
Title: Re: Mach 4 stops processing gcode
Post by: joeaverage on April 06, 2018, 03:49:02 PM
Hi,
in a sense if Mach did not read ahead it wouldn't work.

Windows is not a realtime computing platform. Thus any software like Mach will be interrupted while Windows goes off and services other programs or services as required and then return to Mach.
There is no set schedule as to when Mach is abandoned nor is there any guaranty how long it will be abandoned for. If Mach is starved of service for too long Mach will pause and your machine will
stall wrecking the job in progress.

The solution is to read ahead so that Mach can carry on when it loses CPU service and hopefully is still running when CPU service is restored.

The mechanism that causes the CPU to transfer its focus is the 'interrupt system'. There are many levels of priority amongst interrupts and additionally Windows uses interrupts to signal between threads.
All in all it is not possible to make Windows into a realtime system as that would require a totally different interrupt structure which would hoplessly break Windows.

There is a clever solution, it is a software system which uses one core of a multicore CPU to run a genuine realtime scheduler while the remaining cores run Windows as normal. Unfortunately such a system
is way too expensive for hobby use.

Linux can with certain extensions, called realtime extensions, can be made into a realtime computing platform and LinuxCNC makes very good use of it.

Craig
Title: Re: Mach 4 stops processing gcode
Post by: joeaverage on April 06, 2018, 04:17:47 PM
Hi,

https://www.intervalzero.com/products/rtos-platform-vision/ (https://www.intervalzero.com/products/rtos-platform-vision/)

Craig
Title: Re: Mach 4 stops processing gcode
Post by: smav on April 08, 2018, 01:54:25 PM
Thanks Craig for the info. That makes sense in regards to the reading ahead and cpu usage. Windows may be a multitasking OS theoretically but in reality I believe it is just a very fast single task OS in regards to CPU handling. I did run another shorter gcode script that I wrote in an unrecognized syntax on purpose and that is what happened. The program stopped before actually executing or getting the the syntax.
Thanks again for the reply