MACROLOOP

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

MACROLOOP

Postby shakil1740 » Thu Feb 16, 2023 1:27 am

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.
shakil1740
 
Posts: 9
Joined: Mon Jul 11, 2022 8:22 pm

Re: MACROLOOP

Postby mac6 » Tue Feb 21, 2023 6:50 am

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.
mac6
 
Posts: 4
Joined: Fri Feb 17, 2023 7:09 am

Re: MACROLOOP

Postby dezsoe » Tue Feb 21, 2023 7:20 am

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.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: MACROLOOP

Postby shakil1740 » Fri Feb 24, 2023 12:44 am

Thank you all.
shakil1740
 
Posts: 9
Joined: Mon Jul 11, 2022 8:22 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 12 guests

cron