17009
« on: January 06, 2010, 07:44:40 PM »
Just thought I would mention the way homing is done on my Lathe and Mill because it is similar to your in that it does the homing externally from Mach. My servo drives do the homing and Mach knows nothing about it until the drives send a signal to tell it.
The way I do that is I have the VB in my Ref All button send a signal out to my first axis (Z) and the drive will home and then once there will send a signal back to Mach to tell Mach to press the Home button for the Z axis, the same then happens for Y and X axis. There are no Home switches set up in Mach so as soon as the Home button for any axis is activated the Machine Coords are set to the Home position or Home Off value.
Heres the code I use in the Ref All button on the Lathe.
DoOemButton (240) 'De-Reference All axis
Sleep(10)
If GetOemLED (809) Then 'Check that Ref Z LED is RED
Do
Call SetModOutput (21,1) 'Activate ModOutPut 20
If GetInput(19) Then Exit Do 'Loop until ModInPut 18 is seen
Sleep (10)
Loop
End If
Call SetModOutPut (21,0) 'DeActivate ModOutPut 20
DoOemButton(1024) 'Set Z axis Home
If GetOemLED (807) Then
Do
Call SetModOutPut (20,1)
If GetInput(18) Then Exit Do
Sleep (10)
Loop
End If
Call SetModOutPut (20,0)
DoOemButton (1022)
Hood