Hello Guest it is March 19, 2024, 01:06:13 AM

Author Topic: Auto squaring driving me nuts!  (Read 2330 times)

0 Members and 1 Guest are viewing this topic.

Auto squaring driving me nuts!
« on: March 20, 2017, 07:10:18 PM »
Hello All,

This is my first post here.  Hoping I can get some help.

I have been trying for some time now to get my gantry to autosquare.  So far the only way I have been able to do it is by modifying the button code for the "Ref All Home" button.  It works perfectly but for some reason the slaved motor (B) will not re-slave after the homing and squaring routine is finished.  If I press the up arrow on the keyboard after the machine squares, the Y motor will take off and the B motor will not move and of course it twists the gantry.

I have a brand new purpose built PC running Windows 7, 32 bit.  There is nothing else on the PC except Mach3.
I am running the latest Mach3 version and using the UC100 controller. 
I have the latest plugin installed for the UC100.
I have a separate homing switch for each motor connected to separate pins.
I have the "Home Slave with Master Axis" unchecked in the general config file.

If I install the default button code for the "Ref All Home" button, the machine homes perfectly and the slaved motor remains active however it does not square the bridge.  It also appears that it makes no difference what offset I enter for the slaved motor as the the gantry only moves off the homing switches equal to the offset entered for the Y motor ignoring the B motor offset.

I find it very hard to believe that I have not been able to find a fix for this.  Contacting the makers of the UC100 provided no help so I don't know if this is a Mach3 problem or a UC100 problem but I do know that it is a problem and surely I'm not the only one that is experiencing it.

If there is anyone out there that knows how to fix this I would be eternally grateful.  Other than the above mentioned problem, my machine runs great.

Below is the custom button code that actually squares the gantry but does not re-energize the B motor.

'Early versions of Mach had to make use of the
'following three lines of code after each command:

'While IsMoving
'Sleep(25)
'Wend

'This insured the command completed before going to
'the next line of code.  Newer versions of Mach may
'not need this code or may need it in some places
'and not others.

'If the code seems to "hang" you will need to CTRL+
'ALT+DEL and end the task for Mach3

'Restart the software and run the code again.  This
'time start back ticking some the the While IsMoving
'lines until the machine homes and squares up.

Dim boffset
Dim feedhome

boffset = 0.1 'change this value to adjust for squarness
feedhome = 5 'feedrate which to square the gantry

DoButton( 24 ) 'Home each axis normally
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

DoOEMButton(133)
DoOEMButton(134)
DoOEMButton(135)

While IsMoving
Sleep(25)
Wend
 
DoOemButton(357) 'Deslave Axis
While IsMoving
Sleep(25)
Wend

DoOemButton(1007) 'Zero All Axis
While IsMoving
Sleep(25)
Wend

Code "F" & feedhome
While IsMoving
Sleep(25)
Wend

Code "G1B" & boffset 'Move the B axis a small amount to square the gantry
While IsMoving
Sleep(25)
Wend

DoOemButton(1007) 'Zero All Axis
While IsMoving
Sleep(25)
Wend

DoOemButton(358) 'Slave Axis
While IsMoving
Sleep(25)
Wend

message ("Homing Complete")

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Auto squaring driving me nuts!
« Reply #1 on: March 20, 2017, 09:43:18 PM »
Quote
If I install the default button code for the "Ref All Home" button, the machine homes perfectly and the slaved motor remains active however it does not square the bridge.  It also appears that it makes no difference what offset I enter for the slaved motor as the the gantry only moves off the homing switches equal to the offset entered for the Y motor ignoring the B motor offset.

I think that you're misunderstanding how slaved homing works. Mach3 only backs off the switch until the switch opens. The Home Offset specifies the location of the switch in machine coordinates, Not how far it moves off of the switch.
In order to auto square the gantry, the switches must be located so that the switch locations are what squares the gantry. If you need to move one side a certain amount, then you need to write a custom macro, as you've found.
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Auto squaring driving me nuts!
« Reply #2 on: March 20, 2017, 11:16:24 PM »
Thank you for your reply.  I guess I was expecting the gantry squaring to work the same way it did on the plate glass cutting machines I built for years.  I did do some more looking on this forum and finally found the answer I was looking for which was a simple explanation of what the Home Offset actually is used for.  I will simply adjust my B motor limit switch to square the gantry and be done with it.