Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: rcaffin on January 26, 2012, 10:22:06 PM
-
I seem to be good at this ... :-)
I write my own programs in a parametric style, so there are lots of subroutines.
Sometimes I need two very similar subroutines, so I will do a copy and paste.
Sometimes ... I forget to edit the subroutine label, so(for example) I end up with two o100 subroutines.
Guess what Mach3 does for me when it encounters this?
Flag an error? Nope.
Execute just the last (or first) one? Nope.
Execute both of them sequentially from ONE call? Yep. The results can be a little unexpected. :-)
Any one else seen this?
Cheers
-
You are just experienceing what some of us already know when you move away from just very basic Gcode.
I have never run across that one, but I don't recall trying duplicate Subs.
(;-) TP
-
OK just tried it and it errors out every time with "return called with no sub in effect....looping" as it should have.
(;-) TP
-
You are just experienceing what some of us already know when you move away from just very basic Gcode.
Yeah, I know ... :-)
But ,you know, if I am careful as to what instructions I use in the nested SRs then parametric coding with deep nesting works quite well. g0, g1, g2, g3, drilling - they all work OK. Some rotation and translation also work fine. I've got a lot of working code.
OK just tried it and it errors out every time with "return called with no sub in effect....looping" as it should have.
I have had that error msg when I put an m99 into the top-level code in place of an m98 (oops!), but I don't get that with the duplicate subroutines. Anyhow, that would be the wrong error msg for this problem as the m99 at the end of the second SR is structurally correct.
Odd.
Cheers
-
BUT not if it did NOT have an associated M98 that called it. They come as a pair The m98 calls and the M99 from that sub call returns.
If you try to run the sub code ONLY you get the same message.
Were the 2 subs nested 1 sub inside another I did not test that routine.
Yep I have a lot of parametric subs as well but it can be like russian roulet to get one running. The you give the program to someone and it never runs again on their setup. Been there.
Can you post teh program that runs BOTH subs from one call?? Interesting
(;-) TP
-
Weird here NOW the sub will not run without an M30
M98 P1 L1
o1
(Hello)
M99
%
Will not run, BUT
M98 P1 L1
M30
o1
(Hello)
M99
%
Will run.
Who knows?????? (;-) TP
-
Yep I have a lot of parametric subs as well but it can be like russian roulet to get one running. The you give the program to someone and it never runs again on their setup. Been there.
That's not been my experience. If written correctly with the limited set of g-codes, they always run exactly as intended.
Can you post teh program that runs BOTH subs from one call?? Interesting
That one was 'fixed' to be correct, but the attached demos what happens. it's very simple.
I am of course ASSUMING that it will behave on your machine the same as on my (simulation) machine. But such programs do behave on both my sim box and on the CNC , and give the same results. Oh well, I will be interested to see how it runs on anyone else's machine.
Cheers
Roger
-
HIYA ROger, Testing your version here the 2nd sub runs first then it runs the first sub.
Also with your version it will not run without the M30 as well.
Interesting, (;-) TP
-
Testing your version here the 2nd sub runs first then it runs the first sub.
Likewise. Makes for some very strange bugs at times!
Also with your version it will not run without the M30 as well.
Yeah, well, I don't mind that. Not sure the Standard requires the m30 (or alternatives), but it is reasonable.
Roll on V4 ! ! !
Cheers