Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: civilseal on August 26, 2012, 07:42:30 AM

Title: Problem with homing and limit switches?
Post by: civilseal on August 26, 2012, 07:42:30 AM
I use my limitswitch as a home switch and I need to home off from the switches a few mm as to not trip them accidentally.
I have two problem with this:

1: If I set the softlimits to 2mm, I always have to turn them off when Mach3 starts because the machine is out of limits (x0y0z0) and then turn them on after, which is easy to forget.

2: Even if the Z axis is set to home off to -2mm, is doesnt, it only sets the dro to 2mm and if I jog it upwards it trips the switch at -1.9mm, so for this axis I have to set the soflimits a few mm down and then jog there after I reference the axis?

Title: Re: Problem with homing and limit switches?
Post by: ger21 on August 26, 2012, 09:48:42 AM
Set your X&Y Home Offsets to -2 and your Z Home Offset to  +2 and change your homing script to this:

DoButton( 24 )
Code "G53 G0 Z0"
While IsMoving()
Wend
DoButton( 23 )
Code "G53 G0 Z0"
While IsMoving()
Wend
DoButton(22)
Code "G53 G0 Z0"
While IsMoving()
Wend

This will move the machine 2mm off the switches to 0. Set your softlimits to 0, and you should be good.
Title: Re: Problem with homing and limit switches?
Post by: Hood on August 26, 2012, 10:45:10 AM
Just to add to it, the Home Off is not there to move the axis off the value you set. What it is for is if you have home switches that are not at the extent of the axis you then set a Home Off value and that tells Mach that the actual limit is the set distance away from where you homed.

Gerrys code will work but if you are getting false triggers of limits when you home you likely have poor quality switches that are not positive action.
Hood
Title: Re: Problem with homing and limit switches?
Post by: civilseal on August 26, 2012, 11:28:29 AM
Ok, I got it all wrong then.

I will try this, thank you very much!
Title: Re: Problem with homing and limit switches?
Post by: civilseal on September 13, 2012, 10:14:58 AM
I finally got it working.
It seems like the macro programing is a bit buggy.

This is what I finally got working:

If GetOEMLED(23) Then 'Check if Soft limits is turned on and then turn it off
   DoOEMButton(119)
End If

DoButton( 24 )
While IsMoving()
Wend
Code "G53 G0 Z0"
While IsMoving()
Wend

RefCombination(10)

While IsMoving()
Wend
DoButton( 22 )
While IsMoving()
Wend
Code "G53 G0 X0"
While IsMoving()
Wend
Code "G53 G0 Y0"
While IsMoving()
Wend
DoOEMButton(119) 'Turn soft limits on



One funny thing is that with the code below it skips the Code "G53 G0 Y0"?? :

If GetOEMLED(23) Then 'Check if Soft limits is turned on and then turn it off
   DoOEMButton(119)
End If

DoButton( 24 )
While IsMoving()
Wend
Code "G53 G0 Z0"
While IsMoving()
Wend

RefCombination(10)

While IsMoving()
Wend
Code "G53 G0 Y0"
While IsMoving()
Wend
DoButton( 22 )
While IsMoving()
Wend
Code "G53 G0 X0"
While IsMoving()
Wend
DoOEMButton(119) 'Turn soft limits on