Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 01:44:13 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  General Mach Discussion
| | |-+  Help!! Auto Zero Problem
Pages: 1   Go Down
Print
Author Topic: Help!! Auto Zero Problem  (Read 312 times)
0 Members and 1 Guest are viewing this topic.
LAMEIII
Active Member

Offline Offline

Posts: 16


View Profile
« on: July 12, 2011, 09: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
   


Logged
Tweakie.CNC
Active Member

Offline Offline

Posts: 3,263


Super Kitty.


View Profile WWW
« Reply #1 on: July 13, 2011, 01: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).  Undecided


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.
Logged

Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
BR549
Active Member

Offline Offline

Posts: 2,557


View Profile
« Reply #2 on: July 13, 2011, 09: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
Logged
ger21
Global Moderator
*
Offline Offline

Posts: 2,619



View Profile WWW
« Reply #3 on: July 13, 2011, 10:42:11 AM »

I use a Sleep(250) instead (when not moving), which gives 1/4 second for DRO's to update before continuing.
Logged

LAMEIII
Active Member

Offline Offline

Posts: 16


View Profile
« Reply #4 on: July 13, 2011, 10: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
Logged
Tweakie.CNC
Active Member

Offline Offline

Posts: 3,263


Super Kitty.


View Profile WWW
« Reply #5 on: July 13, 2011, 11:47:41 AM »

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.  Grin Grin

Tweakie.
Logged

Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!