Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 03:18:50 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  How to stop a movement when input is active?
Pages: 1   Go Down
Print
Author Topic: How to stop a movement when input is active?  (Read 722 times)
0 Members and 1 Guest are viewing this topic.
bob1
Active Member

Offline Offline

Posts: 5


View Profile
« on: February 11, 2011, 02:40:29 PM »

Hello all!

First a littel introduction of myself. Iīm a student at a technical school in Germany.
At the moment Iīm building a CNC plasma-router, running with mach3.

I want to write a macro that should automatically set the right hight from the sheet metal.

For this application I need to code something that will stop the movement of the Z-axis when a Input Signal is active.

I wanted to try something like that:

Code:
Input = IsActive(INPUT1)

If Not (IsActive(Input)) Then
Code "G1Z-20F100"                 "Z-Axis is moving a in Z - to touch down on the sheet an trigger the sensor"
While isMoving()
Sleep 100
Wend
Else
DoOEMButton(1003)                   "I wanted to stop the Axis moving with that, but this seems to be wrong in that way!"
End If


This code doesnīt work for me ( Unfortunately, I dont have a big idea about basic  Sad  )

So I just want to stop an Axis movment by an Sensor.
Can anybody help me with that problem?

Thank you in advance!

Greets
Bob

P.S. Sorry if there are to much mistakes in my speech  Grin
Logged
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #1 on: February 11, 2011, 05:11:53 PM »

I dont have all the info on what you are trying to do but following the code you have this would be how you would do it:

Code:
Code "G1 Z -20 F100"
While isMoving()
If (IsOutputActive(Output1)) Then
DoOEMButton(1003)
Sleep 100                
End If
Wend
Logged

Regards, Jason Blake

www.Fusioncnc.com
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #2 on: February 11, 2011, 05:34:40 PM »

BTW: you could use G31 is what I quess you are looking for.
G31 Z-20.0 F100 (Probe in Z)
Logged

Regards, Jason Blake

www.Fusioncnc.com
bob1
Active Member

Offline Offline

Posts: 5


View Profile
« Reply #3 on: February 12, 2011, 08:45:24 AM »

Hi,

Thank you Jason!

I tryied it with your code and the axis is stopping.

But I want it to return straight after it has stopped, and move it incremental to maybe Z +5 ( sorry I didnīt mentioned that in my first explanation ).
With the G31, it is stopping when the Input is active, but not moving any more when the input is active, when I disable the input manually it starts to move back.

Maybe to be clearer I wanna do something like the guy in this short clip (Machine is doing a touch probe with the torch before every cut)

I tryied it like that :

Code:
Code "G31 Z -20 F100"
While isMoving()
If (IsInputActive(Input1)) Then
Code "G91"
Code G0 Z5
Sleep 100                
End If
Wend

But aint working

Any ideas?

Thanks
Bob
« Last Edit: February 12, 2011, 08:47:46 AM by bob1 » Logged
stirling
Global Moderator
*
Online Online

Posts: 1,190

UK


View Profile WWW
« Reply #4 on: February 13, 2011, 04:00:31 AM »

Bob - I'm not sure if you have been told to do this via a VB macro by your school but this is not generally how this is done. IHS (Initial Height Sensing) from the hardware point of view is usually done by one (or more) of: Floating head, Ohmic sensing and capacitive sensing. It sounds from what you've said that you are using the floating head method with a microswitch. If so, you have the option of using either probe based IHS (G31) or home based IHS (G28.1). I'd suggest home based to start with.

In this method, you set your floating head microswitch as a home switch and set home to be -ve (in home/limits). You then use something like the following gcode at the start of each cut:

Code:
G28.1 Z3.00  (home downwards from safe height, 3 is just an example)
G92 Z0.0      (Homed, so set Z to 0)
G00 Z2.8000 (back off for switch travel - yours will likely be different - set distance appropriately)
G92 Z0.0      (set Z to 0)
G00 Z3.8000 (Move up to piearce height - see your plasma cutter manual)
M03             (fire torch)
G04 P0.3      (wait pierce delay - see your plasma cutter manual)
G01 Z1.5000 (descend to cut height - see your plasma cutter manual)
....               (commanded moves in x, y)

Hope this helps

Ian
Logged
bob1
Active Member

Offline Offline

Posts: 5


View Profile
« Reply #5 on: February 13, 2011, 05:39:01 AM »

Thanks Ian,

Yes, I ve got a sensor to do the floating head method. But I īve got a home sensor for homing of the Z-axis as well



here on that picture you can see the lower sensor for the probe and the upper sensor for homing.

I still want to use the upper one for homing.
So wouldnīt it be better to use the G31 option?

Which input do I have to use then? ( Touch probe?)

Could you explain what "-ve" is?
Quote
to be -ve (in home/limits).


Btw:
Quote
I'm not sure if you have been told to do this via a VB macro by your school
Itīs not a school project itīs my private project :-)

Thank you!

Logged
stirling
Global Moderator
*
Online Online

Posts: 1,190

UK


View Profile WWW
« Reply #6 on: February 13, 2011, 07:45:04 AM »

Yes you can use the G31 method if you want. It's one of those things that creates much discussion - G28.1 or G31 - which is better? They both have advantages and disadvantages. To use G31 you'd use the probe input in ports and pins. Then use something like G31 Z -100 instead of the G28.1 line in my previous code. The -100 is just an example - it doesn't really matter as long as your probe touches the metal at some point of course. You might want to add a feedrate in there to control the descent.

-ve is just shorthand for negetive.

Ian
« Last Edit: February 13, 2011, 07:54:07 AM by stirling » Logged
bob1
Active Member

Offline Offline

Posts: 5


View Profile
« Reply #7 on: February 13, 2011, 11:42:40 AM »

Thanks again Ian.

I got it working now.
But I still wrote it into a macro, since I donīt want to edit the G-code every time after it comes from my Cam-System.
So now, it does the touch probe automatically with every M3. And thats the way I wanted it, yeah Iīm lucky  Grin Smiley
Thank you again!

I made a short clip to prove that Itīs working Wink

Bob
Logged
stirling
Global Moderator
*
Online Online

Posts: 1,190

UK


View Profile WWW
« Reply #8 on: February 13, 2011, 12:07:24 PM »

That's good - thanks for the video too.  Smiley

Just a note though. If you prefer a macro, that's fine but you shouldn't even need to edit your code to insert that - ideally your CAM should be set up to insert it for you - either inline code or macro.

Ian
Logged
bob1
Active Member

Offline Offline

Posts: 5


View Profile
« Reply #9 on: February 13, 2011, 12:11:52 PM »

I see

Well Iīm not very into my Cam yet. ( all new for me )

First I thought Iīd have to edit the post processor - which doesnīt seem to be that easy aswell :-)

But itīs ok im pleased now ;-)

Bob
« Last Edit: February 13, 2011, 12:21:46 PM by bob1 » Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!