Hello Guest it is July 11, 2020, 05:38:06 PM

Author Topic: Does my homing code look correct ?  (Read 2464 times)

0 Members and 1 Guest are viewing this topic.

Offline JMF

*
  •  62 62
    • View Profile
Does my homing code look correct ?
« on: January 13, 2014, 08:56:08 PM »
Hi,

I wanted to modify the Ref All button to Home my X,Y and Z, then move to my actual table 0,0 (X,Y) then set the X and Y DRO's to Zero,
I came up with this code and it seems to do exactly what I want, but I just wanted to make sure it is the correct way of doing it.

Thanks,
   John

DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

While (IsMoving())
Sleep(100)
Wend

DoOEMButton(1008) 'Work X Zero
DoOEMButton(1009) 'Work Y Zero
DoOEMButton(1010) 'Work Z Zero
DoOEMButton(1011) 'Work A Zero

While (IsMoving())
Sleep(100)
Wend

Code("F100")
Code("G00 X0.1543 Y.2534")

While (IsMoving())
Sleep(100)
Wend

DoOEMButton(1008) 'Work X Zero
DoOEMButton(1009) 'Work Y Zero
DoOEMButton(1010) 'Work Z Zero
DoOEMButton(1011) 'Work A Zero

While (IsMoving())
Sleep(100)
Wend

DoOEMButton(160) 'Regen Display 

Offline ger21

*
  • *
  •  6,282 6,282
    • View Profile
    • The CNC Woodworker
Re: Does my homing code look correct ?
« Reply #1 on: January 13, 2014, 09:19:02 PM »
You don't need the sleep(100) 's that you have.

And there's an easier way to do what  you're trying to do.
Set Home Offsets for X and Y.
Set X to -.1543 and set Y to -.2534
Then, if your X and Y offsets are always set to zero, then all you would need is this:

DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

While IsMoving()
Wend

Code "G53 G0 X0 Y0"

While IsMoving()
Wend




This is how my machine is setup, as I never change my X0 Y0 positions.
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline Chaoticone

*
  • *
  •  5,629 5,629
  • Precision Chaos
    • View Profile
Re: Does my homing code look correct ?
« Reply #2 on: January 13, 2014, 09:59:54 PM »
I do mine the same as you Gerry but I learned the hard way to do it like this. I did set the home off distance to a negative value. This value was the distance I wanted to be away from the switch when at machine 0. This was on an OEMs machine. The reason I needed this was the hardware it was using stopped immediately after coming off the switch. It was a very tight machine but if I didn't do one axis and move away when the other started to home it would throw the limit for the other that was at this point just insanely close to making the limit/home switch (the one that just finished homing). Another note (if your using soft limits) is that you will likely need to adjust your soft limit Mins. to what ever you set your - values and decrease the soft limit max by the same amount.

DoButton( 24 )
DoButton( 23 )

While IsMoving()
Wend

Code "G53 G0 Y0"

While IsMoving()
Wend

DoButton( 22 )

While IsMoving()
Wend

Code "G53 G0 X0"

While IsMoving()
Wend

DoButton( 25 )

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline JMF

*
  •  62 62
    • View Profile
Re: Does my homing code look correct ?
« Reply #3 on: January 13, 2014, 11:23:43 PM »
Thank you guys very much, I just started learning this stuff earlier today and just wasn't sure,
I appreciate the code, I will change it tomorrow, thanks again guys !!

Offline JMF

*
  •  62 62
    • View Profile
Re: Does my homing code look correct ?
« Reply #4 on: January 14, 2014, 11:39:12 PM »
Ger21, tried your code today and it works like a charm, thanks again.