M99 should not work at all.
It should be:
Code"M99"
And I doubt that it would work on the same line as SetVAR.
I need help to determine why a 3 or 4 line macro, in mach3 (final version) , won't run without compile or syntax errors. Single code snippets run fine! (GetVar, SetVar, Code"xxx")
But as soon as I embed a snippet in a simple " If-Then-End If" construct, I get a compile error at the time of the macro execution.
Example M888: Runs without errors: reads/writes #Vars in G code program verified with "Operator/Var monitor"
SetVar(100, GetVar(101)+3) M99
Example M888: Faults on runtime execution, issues "Compile error"
If GetVar(103) > GetVar(104) Then
SetVar(100, GetVar(101)+3)
End If
M99
Running the debugger produces a compile and syntax error but no reference to the offending line or instruction.
Another oddity:
Works: SetVar(100, GetVar(101)+3) M99
Faults: SetVar(100, GetVar(101)+3)
M99
Can't figure out why moving M99 would make a difference
Similar Threads:
M99 should not work at all.
It should be:
Code"M99"
And I doubt that it would work on the same line as SetVAR.
Gerry
UCCNC 2017 Screenset
[URL]http://www.thecncwoodworker.com/2017.html[/URL]
Mach3 2010 Screenset
[URL]http://www.thecncwoodworker.com/2010.html[/URL]
JointCAM - CNC Dovetails & Box Joints
[URL]http://www.g-forcecnc.com/jointcam.html[/URL]
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Also, I'd try
somenumber = Getvar(101) +3
SetVar(100, somenumber)
Gerry
UCCNC 2017 Screenset
[URL]http://www.thecncwoodworker.com/2017.html[/URL]
Mach3 2010 Screenset
[URL]http://www.thecncwoodworker.com/2010.html[/URL]
JointCAM - CNC Dovetails & Box Joints
[URL]http://www.g-forcecnc.com/jointcam.html[/URL]
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Thanks for the help. Moving M99 into the o100 area of the g code program , after the macro call, removed the compile errors and I was able to use the if- then statement. The debugger offered no help in isolating the problem.Using the m99 on the same line as the setvar didn't work(return me to the subroutine call line, but it didn't generate a compile error either which led me down the wrong path for a while. Hey, it's all good.