Hello Guest it is April 20, 2024, 01:55:36 AM

Author Topic: Auto Z zero oddity, only when using MDI roatation.  (Read 1703 times)

0 Members and 1 Guest are viewing this topic.

Offline Zaae

*
  •  120 120
    • View Profile
Auto Z zero oddity, only when using MDI roatation.
« on: October 27, 2014, 01:04:06 PM »
Hello,

I've had this problem for some time, and can't seem to figure it out. I use the following code for auto Z zero, which works perfectly when MDI rotation is set to zero. If I enter any value in the MDI rotation, the spindle moves slowly down, forward, and right, all at the same time. It does eventually zero if it hits the contact plate, then retracts as normal. The Z lowers, X and Y both increase. Any idea what would be causing this? Here's the code:

Note: I added the sound, and the sendserial to control the vacuum table during zeroing. I tried removing these, and the problem persists.

Code: [Select]
PlayWave ("SOUNDS\AUTOZZERO.WAV")
VacuumOverride = GetVar(7)
If getUserLED(1170)=1 Then
     Call SENDSERIAL(1)
end if     

CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
PlateThickness = 2.40 'GetUserDRO(1151) 'Z-plate thickness DRO

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-20 F75" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
Code "G4 P0.25" 'Pause for Dro to update.
Code "G1Z5 F200" 'put the Z retract height you want here
'code "G0Z5"
While IsMoving ()
Wend
Call SENDSERIAL(0)
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Exit Sub