Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: mfrisina on February 13, 2006, 04:51:01 PM

Title: M98 & 99
Post by: mfrisina on February 13, 2006, 04:51:01 PM
When using M98, I am coding it as M98 P10 and the machine keeps looping more then 10 times.  Also, is it possible to call an external file  as a sub-routine?
Title: Re: M98 & 99
Post by: Brian Barker on February 13, 2006, 06:01:22 PM
A sub should look like this:

(my main program)
G00 X0 Y0
M98 (Other.Tap) L10 (call this program and run it 10 times) <---- Edit :)
M30

The other file would be
(Other.tap)
G91
X2.0 Y1.0
G01 Z-3.0 F30
G00 Z3.0
M99


How is that, any help?
Title: Re: M98 & 99
Post by: mfrisina on February 14, 2006, 11:41:01 AM
Are you sure about G98?  Shouldn't it be M98?  Doesn't matter, I can't get either to work.

Mike
Title: Re: M98 & 99
Post by: Brian Barker on February 14, 2006, 11:46:39 AM
Sorry M98 :)

What are you getting for an error? Try This all in the same file:

(my main program)
G00 X0 Y0
M98 P1000 L10 (call this program and run it 10 times)
M30

O1000
G91
X2.0 Y1.0
G01 Z-3.0 F30
G00 Z3.0
M99
Title: Re: M98 & 99
Post by: mfrisina on February 14, 2006, 12:13:19 PM
Well, I tried you new code and it does call the subroutine.  When I Single BLK and cycle start, the code goes jumps to the subroutine, and runs the code in the subroutine once and then stops on the last line, which, interestingly enough, is not the M99, but the line before the M99 and the M99 never shows in the g-code window.  When I tried to use an external .tap file, with the "P" word, I get a "Unknown word where unary operation could." If I use your example, and put "()" around the file name, I get a "Connot Load original File"

Mike
Title: Re: M98 & 99
Post by: nicad on February 14, 2006, 12:40:33 PM
I have seen this same thing in Mach3. It will not show or get to the last line, which so far has always been M99 or M30.
One time I simply edited the code and put a couple of <enters> after the last line, and that actually fixed it.
Other times it still ignored it.
It also seems to make a difference in how you start the program.. but I haven't nailed it down yet.
Title: Re: M98 & 99
Post by: Brian Barker on February 14, 2006, 01:14:45 PM
hit enter at the end  and all will be good  :)

Title: Re: M98 & 99
Post by: trying2cnc on October 22, 2006, 10:22:43 AM
A sub should look like this:

(my main program)
G00 X0 Y0
M98 (Other.Tap) L10 (call this program and run it 10 times) <---- Edit :)
M30

The other file would be
(Other.tap)
G91
X2.0 Y1.0
G01 Z-3.0 F30
G00 Z3.0
M99


How is that, any help?

Hi I'm trying to call a sub program I have used your example and still can't get iti working can you see where I'm going wrong?
Title: Re: M98 & 99
Post by: Hood on October 22, 2006, 01:53:08 PM
I am a real beginner at Gcode but heres what I do
You need to hit enter key after the last line (ie M99) I always tend to put in a % sign as the last line, that works the same as hitting the enter key and I know it is there because I see it in the text file ;)
Should look like this
(my main program)
G00 X0 Y0
M98 P1000 L10 (call this program and run it 10 times)
M30

O1000
G91
X2.0 Y1.0
G01 Z-3.0 F30
G00 Z3.0
M99
%
Title: Re: M98 & 99
Post by: Graham Waterworth on October 22, 2006, 01:56:06 PM
Try it like this :-

enter this all as one .tap file

(main program)
G00 X0 Y0
M98 P1001 L10
M30

O1001
(sub program)
G01 x.........
.............
............
M99

Make sure you have a carriage return on the last line

Graham.
Title: Re: M98 & 99
Post by: Graham Waterworth on October 22, 2006, 01:57:59 PM
Hi hood

great minds think alike

Graham.
Title: Re: M98 & 99
Post by: Hood on October 22, 2006, 02:05:27 PM
Or in MY case it should be
Fools seldom differ

Hood
Title: Re: M98 & 99
Post by: kree8tiv on October 25, 2006, 09:48:01 AM
Is there any way we can call another G-code file from within a program by using M98?  I have tried  a bunch of ways but with no success.  I have a few applications where the benefits of batching files would be huge.

In other systems you can simply call a file by entering M98 "C:/My Documents....".  That would be very useful IMHO.
Title: Re: M98 & 99
Post by: Graham Waterworth on October 25, 2006, 03:10:23 PM
This is what the Mach3 documentation says about sub programs :-

Graham.
Title: Re: M98 & 99
Post by: JB on January 17, 2007, 11:06:08 PM
Kree8tiv,

  The file reference you are looking for has only been available in my experience on controls that have quite respectable look-ahead capabilities, wherein they can look ahead up to 100's and sometimes 1000's of lines. In order for a control to look ahead at a subroutine is one thing, but to look ahead at another seperate file and read its contents is another step. I haven't ran across that info regarding Mach3, but I'm thinking that it's not in that realm.

  One of the tech's from DMG explained to me at one time that the lookahead line count is "consumed" by the main program first, which when using embedded sub-routines these are supposedly counted in the main program count, when using sub-routine files that are loaded into the same directory (for instance in main buffer on a Fanuc machine) these lines are looked at ahead after the complete main program, and then those remote files also secondarily. Not ever tested by me, but this is what I was told by a person I know to be a consumate pro.

  I've only seen that type of super-functionality on Heidenhain controls and Okuma machines, which are pretty darned pricey. I'd say that asking Art to add this sort of processing control may be more than we really want - as the more power the more $.

My 2cents.

Rgds,
John