Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: picoworm on October 29, 2014, 08:29:28 AM

Title: How to stop gcode("") by activation of signal?
Post by: picoworm 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?
Title: Re: How to stop gcode("") by activation of signal?
Post by: TPS 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
Title: Re: How to stop gcode("") by activation of signal?
Post by: stirling on October 29, 2014, 12:53:21 PM
I'm guessing this is a classic case of the XY problem (http://xyproblem.info). Can you describe what it is you want to do rather than how you think you might do it?
Title: Re: How to stop gcode("") by activation of signal?
Post by: Overloaded on October 29, 2014, 03:33:23 PM
I'm guessing this is a classic case of the XY problem (http://xyproblem.info). 

I like that !  Powerful advise.
Thanks Ian,
Russ
Title: Re: How to stop gcode("") by activation of signal?
Post by: stirling 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
Title: Re: How to stop gcode("") by activation of signal?
Post by: ger21 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.
Title: Re: How to stop gcode("") by activation of signal?
Post by: TPS 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
Title: Re: How to stop gcode("") by activation of signal?
Post by: picoworm 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.
Title: Re: How to stop gcode("") by activation of signal?
Post by: TPS 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
Title: Re: How to stop gcode("") by activation of signal?
Post by: picoworm 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.
Title: Re: How to stop gcode("") by activation of signal?
Post by: ger21 on November 03, 2014, 05:28:59 PM
Some Mach3 motion controllers have Index homing built in.
Title: Re: How to stop gcode("") by activation of signal?
Post by: stirling on November 04, 2014, 04:35:02 AM
See what I mean about X Y?

Y = How to stop gcode("") by activation of signal?

whereas

X = How do I get Mach to do index homing?
Title: Re: How to stop gcode("") by activation of signal?
Post by: picoworm on November 04, 2014, 04:42:38 AM
X Y Z, does not matter.
I have got my answer. Next time when I will ned to stop motion I will know how to do it.
Title: Re: How to stop gcode("") by activation of signal?
Post by: stirling on November 04, 2014, 05:27:57 AM
Ah well that's OK then - screw the folks who wasted their time eh?