Hello Guest it is March 29, 2024, 03:50:59 AM

Author Topic: How to stop gcode("") by activation of signal?  (Read 7017 times)

0 Members and 1 Guest are viewing this topic.

How to stop gcode("") by activation of signal?
« on: October 29, 2014, 08:29:28 AM »
Hi everyone,
I need to implement something like next:
-------------------
gcode("G0X400")
while IsActive(INPUT1)
sleep(10)
wend
StopMotion() ;// Here I need to stop execution of GCode immediately
---------------------
What command stops motion?

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: How to stop gcode("") by activation of signal?
« Reply #1 on: October 29, 2014, 09:02:17 AM »
Hi,

DoButton(3)

here: http://www.machsupport.com/Mach3Wiki/index.php?title=Main_Page
is a documentation.

Regards Thomas
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: How to stop gcode("") by activation of signal?
« Reply #2 on: October 29, 2014, 12:53:21 PM »
I'm guessing this is a classic case of the XY problem. Can you describe what it is you want to do rather than how you think you might do it?
Re: How to stop gcode("") by activation of signal?
« Reply #3 on: October 29, 2014, 03:33:23 PM »
I'm guessing this is a classic case of the XY problem

I like that !  Powerful advise.
Thanks Ian,
Russ

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: How to stop gcode("") by activation of signal?
« Reply #4 on: October 30, 2014, 06:33:37 AM »
Cheers Russ. I remember a thread a ways back that started very similar to this one. He asked how to stop a limit switch taking Mach into reset. Turned out after a long and frustrating thread the guy was trying to rewrite limits to work like a probe because he didn't realize that probe existed. Just trying to avoid that here if it's similar.

Ian

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: How to stop gcode("") by activation of signal?
« Reply #5 on: October 30, 2014, 09:03:52 AM »
In this case, the simple answer would be to use one of the Limit inputs, rather than Input 1. No code would be needed at all.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: How to stop gcode("") by activation of signal?
« Reply #6 on: October 30, 2014, 02:46:45 PM »
Hi Guys,

as long we dont know, what picoworm is trying to do,
it's only a look into the "cristal ball".
my "cristal ball" is out of order, because the lamp is
broken, and nobody is around to change the lamp.

Regards Thomas
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: How to stop gcode("") by activation of signal?
« Reply #7 on: November 03, 2014, 04:36:13 AM »
Thanks to TPS, all works. But I need to make a pause after dobutton(3) before start new code("").
I used sleep(100) for it

As about other replies:
I am making my own referencing procedure.

All I need is jogon and jogoff, but unfortunately this functions do nothing on my machine.
Looking the internet do not give me any answer about this problem, so to finish my job, I need to use something else to do Jog.

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: How to stop gcode("") by activation of signal?
« Reply #8 on: November 03, 2014, 02:58:38 PM »
hello picoworm,

don't want to interupt you in your own way of making a reference sequence,
but all this VB stuff will be to slow for what ever you try to do.

hope i can make me understand in my bad german english.

Regards Thomas
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: How to stop gcode("") by activation of signal?
« Reply #9 on: November 03, 2014, 04:03:22 PM »
I my case, precise referencing is done by probe function (g31). I multiplex the probe input to 3 servomotor's encoder zero pulse using external logic.

But before precise referencing, I need to move to HOME switch, then move back from it.

Today I finished my work. It works fine. Repeatability on my 2500 lines encoder and 5mm ballscrew is less than 2um.

I am glad that mach3 can do industrial referencing, it is bad that this function is not inside mach3 and need to be done using such tricks.