Hello Guest it is March 29, 2024, 03:42:02 AM

Author Topic: M98 subroutine L-word doesn't call subroutine correct number of times  (Read 7951 times)

0 Members and 1 Guest are viewing this topic.

I have a program with the line "M98 P2 L2".  It should call subroutine O2, two times. However, it calls the subroutine 4 times.  Has anyone every seen this?  I originally had "M98 P2 L12" - I stopped the program after the subroutine was called 17 times.  I then changed the L word to L2 to see what would happen and now it calls 4 times.  I upgraded to the latest stable version, R3.042.032, but no change in behavior.  I am running Win XP and the machine is an IH CNC mill.  Here's the whole program:

G0 Z5
G0 x-24 y9.24
g0 z0
M98 P2 L2
g0 z5
M30
(O1 - drill bolt hole)
O1
F50
G0 Z1
G1 Z-24
G0 Z5
M99
(O2 - cut out clear area for bolt head, x- y+)
O2
F100
g91
g1 z-1
g90
G0 x-24 y9.24
g1 x-9.24
g1 y24
g1 x-14.24
g1 y14.24
g1 x-24
g1 y19.24
g1 x-19.24
g1 y24
g1 x-21
g1 y21
g1 x-24
g0 y9.24
m99

Offline Chip

*
  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: M98 subroutine L-word doesn't call subroutine correct number of times
« Reply #1 on: November 24, 2009, 07:13:35 PM »
Hi Bucky

It's rearing the (O2 - cut out clear area for bolt head, x- y+) as if it was another O2 put a ";" as below or delete the line

;(O2 - cut out clear area for bolt head, x- y+)

There are some other issues with the M98 routine and  it needs to be looked at.

Chip

Offline Chip

*
  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: M98 subroutine L-word doesn't call subroutine correct number of times
« Reply #2 on: November 24, 2009, 10:47:14 PM »
Hi, All

Hera's an example of issues, I think Only One of these "O30"es should be Used by the "M98 P30 L1" routine or Recognized by the G-code Loader/Interpreter.
Mach3 Ver. R3.042.032

G80 G90
N10 M98 P30 L1
G01 Z0
M30
%

'O30 (CUT'S THIS FORTH "WHY")
G01 Z-.25 F20
G01 X1
G01 Y-1
G01 X0
G01 Y0
M99

(O30) (CUT'S THIS THIRD "WHY")
G01 Z-.25 F20
G01 X-1
G01 Y1
G01 X0
G01 Y0
M99

O30 (CUT'S THIS SECOND "OK")
G01 Z-.25 F20
G01 X-1
G01 Y-1
G01 X0
G01 Y0
M99

O0030 (CUT'S THIS FIRST "WHY")
G01 Z-.25 F20
G01 X1
G01 Y1
G01 X0
G01 Y0
M99

%

Any Thought's, Chip
« Last Edit: November 24, 2009, 11:03:39 PM by Chip »

Offline Chip

*
  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: M98 subroutine L-word doesn't call subroutine correct number of times
« Reply #3 on: November 24, 2009, 11:26:09 PM »
Hi, All
I did see in the manual that the "%" or "\\" and "()" should be used for Comment's and such.

In the End Shouldn't some of these be rejected or load of a file be halted as an Error.

10.5.5 Comments and Messages
A line that starts with the percent character, %, is treated as a comment and not interpreted
in any way.
Printable characters and white space inside parentheses is a comment. A left parenthesis
always starts a comment. The comment ends at the first right parenthesis found thereafter.
Once a left parenthesis is placed on a line, a matching right parenthesis must appear before
the end of the line. Comments may not be nested; it is an error if a left parenthesis is found
after the start of a comment and before the end of the comment. Here is an example of a line
containing a comment: G80 M5 (stop motion)
An alternative form of comment is to use the two characters // The remainder of the line
is treated as a comment
Comments do not cause the machining system to do anything.
A comment that is included in parenthesese, contains a message if MSG, appears after the
left parenthesis and before any other printing characters. Variants of MSG, which include
white space and lower case characters are allowed. Note that the comma which is required.
The rest of the characters before the right parenthesis are considered to be a message to the
operator. Messages are displayed on screen in the "Error" intelligent label.

Thanks, Chip
Re: M98 subroutine L-word doesn't call subroutine correct number of times
« Reply #4 on: November 25, 2009, 12:32:09 AM »
Just a guess....The "O" line can NOT have an "N" word and line # in front of it. It may also mean that there must be NOTHING in front of it as well.
Not any character of any kind.
Maybe ?
Russ

Offline Chip

*
  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: M98 subroutine L-word doesn't call subroutine correct number of times
« Reply #5 on: November 25, 2009, 12:55:38 AM »
Hi, Russ

I Agree, Except the second one has no character in front of it and the others are commonly used to comment out or hide Text, Hears a better file to look at.

If theirs an N## it doesn't run it at All.

G80 G90
M98 P30 L1
G01 Z0
M30
%

;O30 (CUT'S THIS FIFTH "WHY")

G01 Z-.5 F20
G01 X-1
G01 Y-1
G01 X0
G01 Y0
M99

\\ O30 (Doesn't CUT'S THIS "OK" and skips the G code to the m99 also when run)

G01 Z-.25 F20
G01 X-1
G01 Y-1
G01 X0
G01 Y0
M99

% O30 (Doesn't CUT'S THIS "OK" and skips the G code to the m99 also when run)

G01 Z-.25 F20
G01 X-1
G01 Y-1
G01 X0
G01 Y0
M99

'O30 (CUT'S THIS FORTH "WHY")

G01 Z-.25 F20
G01 X1
G01 Y-1
G01 X0
G01 Y0
M99

(O30) (CUT'S THIS THIRD "WHY")

G01 Z-.25 F20
G01 X-1
G01 Y1
G01 X0
G01 Y0
M99

O0030 (CUT'S THIS SECOND "WHY")

G01 Z-.25 F20
G01 X1
G01 Y1
G01 X0
G01 Y0
M99

O30 (CUT'S THIS FIRST "OK" This is the only one that should be executed)

G01 Z-.25 F20
G01 X-1
G01 Y-1
G01 X0
G01 Y0
M99

%

Thanks, Chip
« Last Edit: November 25, 2009, 04:28:11 AM by Chip »

Offline RICH

*
  • *
  •  7,427 7,427
    • View Profile
Re: M98 subroutine L-word doesn't call subroutine correct number of times
« Reply #6 on: November 25, 2009, 10:27:24 AM »
Russ's comment is valid, but the other stuff, well only Brian would know or can fix.
Your posting puts it into perspective. My question would be "How do you know that specific problems
reported are not lost and will be taken care of over time?

Maybe we should create a "PROBLEMS LIST" viewable by all but can only be added to by moderators.
This way memory of problems would not fade.

RICH
Re: M98 subroutine L-word doesn't call subroutine correct number of times
« Reply #7 on: November 25, 2009, 10:56:43 AM »

> It's rearing the (O2 - cut out clear area for bolt head, x- y+) as if it was another O2 put a ";" as below or delete the line
> ;(O2 - cut out clear area for bolt head, x- y+)

Thanks, Chip.  Removing the parenthesized line does fix the problem, but of course a comment line *should* be completely ignored by the parser.  Are there other known problems in the way comments are handled?

Offline alenz

*
  •  137 137
    • View Profile
Re: M98 subroutine L-word doesn't call subroutine correct number of times
« Reply #8 on: November 25, 2009, 12:32:49 PM »
Hi,Chip

For some reason it seems to depend on whether there is a space between the comment designator and the O30.

Here’s what I get, (referencing your sample code):

CO30 CUTS
C O30 NO CUT

%O30 CUTS
% O30 NO CUT

;O30 CUTS
; O30 NO CUT

And even:

NO30 CUTS
N O30 NO CUT

But there are exceptions as:

//O30 NO CUT
// O30 NO CUT

\\O30 NO CUT
\\ O30 NO CUT

I would think that leading zeros are OK and should be allowed as in the O0030.
For what it’s worth.
Al
Re: M98 subroutine L-word doesn't call subroutine correct number of times
« Reply #9 on: November 25, 2009, 01:38:08 PM »
This will all become somewhat moot shortly, when Mach3 V4 comes out - It will use a completely new and different G-code parser, and will accept *only* () for comments.

Regards,
Ray L.
Regards,
Ray L.