Hello Guest it is March 28, 2024, 06:43:50 PM

Author Topic: Tool probe macro  (Read 8257 times)

0 Members and 1 Guest are viewing this topic.

Offline MarkC

*
  •  94 94
    • View Profile
Tool probe macro
« on: December 12, 2009, 08:44:57 PM »
I'm having problems with my tool probe macro. It's one that I had modified from one that I found posted on this forum. The probe is one with a spring loaded plate that is mounted permantly to the table of my mill.
Sometimes the tool will stop short of the plate and go home, so I usually jog closer to the probe. Sometimes it will feed AWAY from the probe. Pressing ESC will stop the feed and it will rapid home. It usually works fine, I get repeatability of .001" or so, but these actions really have me baffled. 

Thanks in advance
Mark

If IsSuchSignal (22) Then
Fixture_Num = GetOEMDRO(46)
Call SetOEMDRO (46, 202) 'Set to fixture number 202
Code "G0 G53 Z00." 'Height to move into probe pos

Code "G59 p202 X0. Y0." 'Move into Probe Pos ***EDIT HERE***

Tool_Number = GetDRO(24)
code "G91 g31 z-6. f10."
While IsMoving()
Wend
If Tool_Number = 0 Then 'Master tool Cal
z = GetOEMDRO(85) 'get Machine ZPos
Call SetOEMDRO(49,z) 'Set fixture offset
Else
Call SetDRO(24,0) 'Turn off the tool offset by loading tool #0
Height = GetDRO(2) 'Get the pos of the Z axis without the Tool comp on

Call SetDRO(24,Tool_Number) 'Turn the tool Back on so the offset will go to the
Call SetoemDRO(42,Height) 'Set the Tool Height offset
End If
Call SetOEMDRO(46,Fixture_Num) 'Set the Fixture back to what it was
Code "G49"
code "G0 G90 G53 Z0.0"
While IsMoving()
Wend
End If
Mark
Re: Tool probe macro
« Reply #1 on: December 12, 2009, 09:44:42 PM »
EVERY Code statement that performs a move should be followed by:

While (IsMoving())
   Sleep 10
Wend

This will ensure the move has completed before the next statement is executed.

Regards,
Ray L.
Regards,
Ray L.

Offline MarkC

*
  •  94 94
    • View Profile
Re: Tool probe macro
« Reply #2 on: December 12, 2009, 09:48:22 PM »
 ;D
Thanks Ray, I'll give it a try

Mark
Mark

Offline MarkC

*
  •  94 94
    • View Profile
Re: Tool probe macro
« Reply #3 on: December 14, 2009, 09:18:30 PM »
Well, that didn't work Ray. Is it possible I'm getting noise?
I do have issues with the computer too, so I'll set up a new one and try again

Mark
Mark

Offline MarkC

*
  •  94 94
    • View Profile
Re: Tool probe macro
« Reply #4 on: December 15, 2009, 09:05:53 PM »
Well, Still not working.
Newly formatted computer, faster than the previous one, latest lockdown version of Mach. I changed the sleep value from 10 to 30. About every third time it will stop short of the probe, sometimes only about .100", sometimes several inches.
Any ideas?

Mark
Mark
Re: Tool probe macro
« Reply #5 on: December 15, 2009, 10:17:09 PM »
Well, Still not working.
Newly formatted computer, faster than the previous one, latest lockdown version of Mach. I changed the sleep value from 10 to 30. About every third time it will stop short of the probe, sometimes only about .100", sometimes several inches.
Any ideas?

Mark

Sounds like you have noise on the PROBE input.  Try putting a 100 ohm pullup resistor to +5V on the PROBE pin.

Regards,
Ray L.
Regards,
Ray L.

Offline MarkC

*
  •  94 94
    • View Profile
Re: Tool probe macro
« Reply #6 on: December 15, 2009, 11:32:06 PM »
Actually I'm looking at something else now.
If I MDI a tool change(I have no tool changer) it will work fine. If I try to run the toolset macro again it will fail every time. After another M6 with a different tool it will work again only to fail again if I try to run it again without a M6. So I'm thinking it is the macro that doesn't leave it in the same state as after a tool change and that's interfering somehow with the execution.
Here is the new macro (I added a faster feed then backup and feed to set the offset):

If IsSuchSignal (22) Then
Code "G49"
Fixture_Num = GetOEMDRO(46)
Call SetOEMDRO (46, 202) 'Set to fixture number 202
'Code "G0 G53 Z00." 'Height to move into probe pos

'Code "G59 p202 X0. Y0." 'Move into Probe Pos ***EDIT HERE***

Tool_Number = GetDRO(24)
code "G91 g31 z-9. f20."
While (IsMoving())
  Sleep 30
Wend

code " g0 z.1"

code "G91 g31 z-9. f5."
While (IsMoving())
  Sleep 10
Wend



If Tool_Number = 0 Then 'Master tool Cal
z = GetOEMDRO(85) 'get Machine ZPos
Call SetOEMDRO(49,z) 'Set fixture offset
Else

Call SetDRO(24,0) 'Turn off the tool offset by loading tool #0
Height = GetDRO(2) 'Get the pos of the Z axis without the Tool comp on
Call SetDRO(24,Tool_Number) 'Turn the tool Back on so the offset will go to the
Call SetoemDRO(42,Height) 'Set the Tool Height offset
End If

Call SetOEMDRO(46,Fixture_Num) 'Set the Fixture back to what it was
'Code "G49"
code "G0 G90 G53 Z0.0"
code "G43"
While (IsMoving())
  Sleep 10
Wend
End If
           

Mark
Mark

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Tool probe macro
« Reply #7 on: December 16, 2009, 10:06:05 AM »
Two things come to mind here Mark.

Firstly you appear to be moving the Z axis a max of -9 units which means that if it starts more than 9 units away it will not get there.
Secondly I think you should zero your Z axis DRO with 'DoOEMButton(1010)' before making the move as this will prevent possible moves in the wrong direction.

Hope this is relevant or else I have totally misunderstood the original question.  :-\

Tweakie.
PEACE

Offline MarkC

*
  •  94 94
    • View Profile
Re: Tool probe macro
« Reply #8 on: December 16, 2009, 05:14:20 PM »
Thanks for the reply.
My total z travel is less than the 9", hence that value.
I'll try zeroing the z axis and see how it works.
I'm still learning scripting so thanks for the help Tweakie and Ray

Mark
Mark

Offline MarkC

*
  •  94 94
    • View Profile
Re: Tool probe macro
« Reply #9 on: December 16, 2009, 09:47:16 PM »
Well the OEM1010 didn't work.
If there were anything other than zero in the DRO for p202 it would set a fixture offset and the tool offset would be off by that amount. While that would probably be OK, I wanted to make sure that could never happen.
What I ended up doing was put a DOEMButton(179) before the measuring movement and a DoOEMButton(181) after. This puts the DRO into machine coordinate mode, so it will always be zeroed at home and use the measurement from there. The 181 will set it back to program coordinates.
Thanks again for the help, I'm starting to get a little clearer on scripting

Edit: I'm thinking I can probably get rid of the G59 junk and just do everything from home position. I'll try that and clean up the scripting and post it here later so anyone else interested can use it. Gotta go make dinner!

Mark
« Last Edit: December 16, 2009, 09:59:31 PM by MarkC »
Mark