Page 1 of 1

M98 G65 Loop counts / can't set to zero

Posted: Fri Dec 01, 2023 4:51 pm
by SplashyLava
Sometimes when I run either M98 or G65 I would like to "turn the subProgram off by using a loop count of zero. This does not seem to work though as the sub will always run once unless I comment it out. That's difficult when the sub in question is nested in another file.

Is there a way to list these subPrograms in my main file and setting them so they only run when desired?
I have #variables in my main program which I set to anything from zero to 25 repetitions. I just cannot get the zero to do what I think it should.

I just need to loop things in an adjustable scenario where the least run amount is "0".

Maybe I need to skip them instead by using some form of IF statement??

Thanks.

Re: M98 G65 Loop counts / can't set to zero

Posted: Sat Dec 02, 2023 12:19 am
by cncsnw
Your last suggestion there is probably the shortest path to success.

Code: Select all

IF [#101 > 0] THEN G65 "MyMacro.cnc" A_ B_ C_ X_ Y_ Z_ L#101
That said, it might be a nice, and relatively simple, enhancement to have CNC12 skip the macro call if L is specified and it is zero.

Does anyone know what Fanuc or Haas or other controls do, given a G65 call with an L0 repeat count?

Re: M98 G65 Loop counts / can't set to zero

Posted: Sat Dec 02, 2023 8:21 am
by SplashyLava
My past experience is only with Mach4 which does skip if the loop is set to zero.