Hello Guest it is April 18, 2024, 09:06:54 PM

Author Topic: Ref All Axes - All at same time?  (Read 7015 times)

0 Members and 1 Guest are viewing this topic.

Ref All Axes - All at same time?
« on: October 17, 2014, 02:46:30 PM »
When I turn my machine on, the first thing I do is reference all the axes as I'm sure most people do.  Is it possible to modify the code so all axis move at same time, rather than z, y, then x?  I always move my spindle to a position that won't cause a crash before I hit the Ref All button.  Anything to save time!  I'm not sure if its possible to have all 3 axes operate simultaneously while monitoring the limit switches.

Example:  After hitting the Ref All button, all three axes start moving towards the limit switches.  As soon as one hits, it backs off the switch as usual, but the other two axes keep on moving and independently monitoring their limit positions.  Maybe it would be easier to have each axis stop as soon as it hits the switch, while the others keep on moving until all three are at their limits, and then each could back off independently (or at same time)?  I like the first option the best, but am just not too good at writing code, unless it is g-code :)  

I would further modify it to do a 2nd touch and a much slower feed rate for a little better accuracy.   Right now my machine coordinate (0,0,0) position slightly changes each time I do a Ref All.  I'm aware this is because of the poor quality and repeatability of my limit switches, but still this is extremely annoying because it forces me to complete a whole job in one session on the machine for fear of losing my WCS origin.  I think I'll get better results with a 2nd touch of the limit switches at a slower feed rate.

Thanks in advance for the help!

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Ref All Axes - All at same time?
« Reply #1 on: October 17, 2014, 07:02:38 PM »
Is each switch using it's own input pin? It must if you want to home all axis together.
You want to use the RefCombination command in your homing script.

Here's a homing script for double homing:

DoButton(24)
DoButton(23)
DoButton(22)
While IsMoving()
Sleep(100)
Wend
SetParam("XRefPer", GetParam("XRefPer")/10)
SetParam("YRefPer", GetParam("YRefPer")/10)
SetParam("ZRefPer", GetParam("ZRefPer")/10)
DoButton(24)
DoButton(23)
DoButton(22)
While IsMoving()
Sleep(100)
Wend
SetParam("XRefPer", GetParam("XRefPer")*10)
SetParam("YRefPer", GetParam("YRefPer")*10)
SetParam("ZRefPer", GetParam("ZRefPer")*10)
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Ref All Axes - All at same time?
« Reply #2 on: October 17, 2014, 07:26:51 PM »
Not sure I follow.  You mention to use the RefCombination command, but it isn't used in your example.  And yes, I am using separate x, y, z limit switches on separate inputs.  Also using your 2010 screenset :)

Where is a good source to find the explanation of the code functions and how they are formatted? (i.e. IsMoving, Set Param, RefCombination, etc...)

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Ref All Axes - All at same time?
« Reply #3 on: October 17, 2014, 07:46:00 PM »
Read the back of the 2010 manual. It explains how to use ref combination.

The code I posted is something I have saved. Just substitute RefCombination for the DoButton commands.
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Ref All Axes - All at same time?
« Reply #4 on: October 18, 2014, 01:37:39 PM »
Ha.  I've read that manual so many times and always skipped over that part thinking I'll never need that!   Thanks.  Makes sense, but the command seems to use the usual feed rate.  How do I slow it to 1 ipm for the 2nd touch?

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Ref All Axes - All at same time?
« Reply #5 on: October 18, 2014, 02:41:22 PM »
The first probe is the percentage of velocity in motor tuning. The second touch is 10% of that. So if your velocity was 100ipm, and your homing speed was 10% (10ipm), then the second home would be at 1ipm.

You can change the 10% in the code to something else to get what you want.
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Ref All Axes - All at same time?
« Reply #6 on: October 18, 2014, 07:41:57 PM »
Thanks.  So DoButton(xx) is the built-in macro to move an axis to the switch, then back it off?  Where can I see the code for this or find other DoButton codes (just to look around and learn).

Just for curiosity and learning, why sleep(100) in between the While and Wend?

I see the parameters are all divided by 10.  I take it these parameters are the feed rates.  Now I get that the end of the code just resets the parameters (multiply by 10) to what they originally were before the macro finishes.

Thanks,

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Ref All Axes - All at same time?
« Reply #7 on: October 18, 2014, 08:02:44 PM »
Actually, DoButton() is an older call, and has been replaced by DoOEMButton(). But most people still use DoButton() in their homing scripts.

http://www.machsupport.com/Mach3Wiki/index.php?title=OEM_Buttons

Get rid of the sleep(100). That's an old script and the sleep() is no longer needed.

No, they are not feedrates, but homing rates. I think that they may be the percentage values on Config > Homing/Limits
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Ref All Axes - All at same time?
« Reply #8 on: October 18, 2014, 11:57:21 PM »
Thanks again Gerry.  I'm just trying to help you get to 4,000 posts :)
Ref All Axes - All at same time?
« Reply #9 on: October 19, 2014, 05:13:45 PM »
Update.  I just tried it out.  All three axes move at same time, hit their switch and then back off.  After this nothing happens and I am unable to jog the axes unless I reset first.   I was expecting to see the axes go back for the switches a 2nd time.  I commented out all lines expect the first RefCombination line, and I was able to jog the aces immediately after homing was complete.  Ideas?