Hello Guest it is May 24, 2024, 02:28:21 AM

Author Topic: How do I increment value in M98 subroutine  (Read 3740 times)

0 Members and 1 Guest are viewing this topic.

How do I increment value in M98 subroutine
« on: August 11, 2009, 02:26:53 PM »
I would like to increment the Z axis depth when using a M98 call to subroutine, to make multiple passes at increasing depths.
For example, an OD path of a part, using cutter comp.

There is an example of such a move in the Wizard for cutting a spline. That code loops in a M98 call subroutine, and the rotary axis increments a given amount of degrees after cutting each tooth, and the Q value is set to the number of splines cut. The rotary table angle increment is 360 divided by the number of teeth input in the Wizard.

I wrote a part contour using G42, and put it into the subroutine called by the M98. There seemed to be no way that the Z axis could be incremented by codes within the called subroutine. That would have made the code much shorter, and also logical.

Since the M98 will make any number of repeating calls i.e. the Q value,  it should be easy.

I ended up using the beginning offset lead-in line bringing the tool into the work, on the line before the "M98 o0001 Q4".
Then I made multiple copies of those two lines,  with each successive lead-in containing the Z depth I wanted.

I edited the "o0001" called subroutine so there was no Z value, just the OD contours in the X,Y, I,J etc.

It all worked, but there has to be a better way of stepping down the Z making multiple passes around the part. I read the manual regarding "Parameters" ,and they all must be integers.

Is there something like a parameter, that can be incremented in discreet numerical values, like .05, or .25 etc.?

On my old Sharnoa CNC control, you could put any value in a parameter, #5=.0156, and then increment that parameter later in the routine, #5 +.1=#5.
Then the Z value would read, Z-#5 where you wanted the depth to change. Each time through the sub-routine the depth would change, or any Axis letter for that matter.

Any suggestions would be appreciated.




Offline Graham Waterworth

  • *
  •  2,683 2,683
  • Yorkshire Dales, England
    • View Profile
Re: How do I increment value in M98 subroutine
« Reply #1 on: August 11, 2009, 05:58:28 PM »
you can put something like this at the start of the sub :-

G91 Z-1. (incremental move)
G90 (back to absolute)

Without engineers the world stops
Re: How do I increment value in M98 subroutine
« Reply #2 on: August 11, 2009, 10:31:38 PM »
Worked like a charm. That is exactly what I wanted.

Thanks Graham.