Page 1 of 1

MACROLOOP

PostPosted: Thu Feb 16, 2023 1:27 am
by shakil1740
Hello,
How can I call M31 macro from macroloop script. I tried this from mpg macro script

if(AS3.GetLED(12) != true) exec.Callbutton(196); // IF INPUT PIN 12 IS ACTIVE THEN START Z PROBE

but it stops with "The Probe sensor was active. The operation was aborted"
and some time probe crash.

Thanks in advance.

Re: MACROLOOP

PostPosted: Tue Feb 21, 2023 6:50 am
by mac6
shakil1740 wrote:Hello,
How can I call M31 macro from macroloop script. I tried this from mpg macro script

if(AS3.GetLED(12) != true) exec.Callbutton(196); // IF INPUT PIN 12 IS ACTIVE THEN START Z PROBE

but it stops with "The Probe sensor was active. The operation was aborted"
and some time probe crash.

Thanks in advance.



It looks like you are trying to call a G-code macro (M31) from a macro loop script in your CNC machine. In order to call a G-code macro from a macro loop, you need to use the appropriate G-code command.

Assuming that the M31 macro is defined in your machine's G-code firmware, you should be able to call it using the "G65" command followed by the macro's parameters. For example:

G65 P8000 X10.0 Y20.0 Z-0.5

This command would call macro number 8000 with the parameters X=10.0, Y=20.0, and Z=-0.5.

You can replace the example parameters with the ones required by the M31 macro you want to call. Make sure to also check the documentation of your machine's G-code firmware to confirm the correct syntax for calling macros with the G65 command.

Re: MACROLOOP

PostPosted: Tue Feb 21, 2023 7:20 am
by dezsoe
shakil1740,

Do not call macro or g-code from macroloop unless you exactly know what you do. Technically you can/may do it but you can mess up your work. Use the input triggers to do it: assign your input to the 196 key code. Using the line that you quoted will result in calling M31 in every loop while the input is low. To do it right you have to check for a high to low state change on the input.

Check the probe LED on the diagnostics page before you start your M31. You get this message when a G31 is started with the probe input already active.

Re: MACROLOOP

PostPosted: Fri Feb 24, 2023 12:44 am
by shakil1740
Thank you all.