Hello Guest it is March 28, 2024, 05:31:03 AM

Author Topic: Help!! Auto Zero Problem  (Read 3369 times)

0 Members and 1 Guest are viewing this topic.

Help!! Auto Zero Problem
« on: July 12, 2011, 10:30:01 PM »
I'm new to CNC routing and have a problem I'm trying to resolve.
I added a Zero plate setup to my machine and can't get it to work properly. Here is what is going on.

I set up the auto zero plate (thickness 0.04" which shows in the plate thickness window) and hit the probe over plate DRO. The spindle slowly lowers until it hits the plate then raises to 0.5 and stops. I then hit the ZO DRO and the spindle lowers to 0.0001. When I then hit start cycle the spindle raises and travels to the start point and then lowers but stays above the work surface by a very very small amount and does not route the wood. The toolpath I'm trying to carve is 0.2" deep.

I can't figure out what I'm doing wrong and I'm hoping someone can guide me in the right direction.

The script for the plate thickness DRO is as follows:

 CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
PlateThickness = GetOemDRO(1151)

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 "G31Z-1 F4" '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 axact 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 "G0 Z.5" 'put the Z retract height you want here
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 aplicable
Exit Sub
End If

LAMEIII
   


Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Help!! Auto Zero Problem
« Reply #1 on: July 13, 2011, 02:59:58 AM »
LameIII,

Try replacing the second G4 with a While...Wend as follows.

(these macro/scripts run at different speeds to Mach and under some circumstances everything gets screwed up but different PC's and different versions of Mach can all respond differently).  :-\


CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
PlateThickness = GetOemDRO(1151)

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 "G31Z-1 F4" '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 axact 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
While IsMoving() 'wait while it happens
Wend
Code "G0 Z.5" 'put the Z retract height you want here
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 aplicable
Exit Sub
End If


Tweakie.
PEACE

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Help!! Auto Zero Problem
« Reply #2 on: July 13, 2011, 10:44:05 AM »
One thing that I have learned with Mach and macros is AFTER every ACTION statement place a While Ismoving(), wend. This HELPS force mach to stay in thread snyc. It is NOT just for movement(;-) I use it as a thread placeholder.

Just a thought(;-) TP

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Help!! Auto Zero Problem
« Reply #3 on: July 13, 2011, 11:42:11 AM »
I use a Sleep(250) instead (when not moving), which gives 1/4 second for DRO's to update before continuing.
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Help!! Auto Zero Problem
« Reply #4 on: July 13, 2011, 11:51:56 AM »
Tweakie,

I really appreciate your help, I made the changes in the script and now my Zero Tool works like a charm. This is going to make my life a lot easier as I get into trying a project that requires several different bits: which is my next project.

Now I'm going to try setting up a joystick. I ran across a program in this forum - "JoyPad Plugin" that I'm thinking about trying.

Again I really appreciate your help. I can see I'm going to have a very long learning curve.

LAMEIII

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Help!! Auto Zero Problem
« Reply #5 on: July 13, 2011, 12:47:41 PM »
I am pleased you got it sorted.

Quote
I can see I'm going to have a very long learning curve.

Iv'e been here 4 years now and I am just starting to scratch the surface - Mach is vast, devious and cunning.  ;D ;D

Tweakie.
PEACE