Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: DC Ross on July 24, 2013, 02:03:24 PM
-
Hey all,
I've been trying to set up a touch plate, and having little to no success. I'm using the script that seems to have been going around for a few years:
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 = .028 '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-5 F5" '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 "G1 Z0.5 F10" 'put the Z retract height you want here
While IsMoving ()
Wend
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
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
The main issue is that GetVar(2002) always returns "0" regardless of where the probe touched.
Also, I hard-coded the plate thickness, since GetUserDRO(1151) also always returned "0" (I entered the thickness in both of the "Gage (sic) Block Height" DROs in the Offsets tab -- why are there two anyway?)
Any help is greatly appreciated.
-
Also, I hard-coded the plate thickness, since GetUserDRO(1151) also always returned "0" (I entered the thickness in both of the "Gage (sic) Block Height" DROs in the Offsets tab -- why are there two anyway?)
Does your screenset have a DRO #1151? If not, you'll need to add one for that call to work.
The two gauge block DRO's each have a button next to them, that have different functions. The buttons read the data from the adjacent DRO's. One button is for setting the Z zero position, the other is for setting a tool length offset.
The main issue is that GetVar(2002) always returns "0" regardless of where the probe touched.
The probe is actually working, but it's not setting the DRO?
How are you checking the value of GetVar(2002)?
Try adding
msgbox ZProbePos
after
ZProbePos = GetVar(2002)
and see what you get.
-
Hi Gerry, thanks for the reply.
I'm using the default screenset, so no idea if it has DRO # 1151 or not. I thought it was one of those two "gage" block DROs, since that's what the image next to them is showing. Not a big deal, since the height of the gauge block won't change.
The probe itself works fine. I stepped through the code, added a breakpoint and checked the value that way (same end result as adding a msgbox), and it always returns "0"
-
Any additional help? Thanks in advance.
-
Your probe is wired to the Probe input in ports and pins > Input pins?
Do you have a valid license file?
I honestly have never heard of this before. And thousands of people do this in Mach3 all the time.
-
Remember you can always use the Var monitor to see the values as they change.
Just a thought, (;-) TP
-
Thanks for the replys.
Gerry, it's wired to port 1, pin 7, and in the Diagnostics screen, the Digitize light is lit when the circuit is completed.
I assume it's a valid version, I bought the whole shebang (cnc router, laptop, mach3) second-hand.
I did inadvertently hit the "Remember" button under the Auto Tool Zero button if that makes a difference.
I'm sure it's something that I'm missing.
Thanks again.
-
On the Input Pins page it says you can only use pins 10-13 and 15.
Pin 7 is an output pin only.
-
Weird. On my Input Signals tab (Config/Ports and Pins), all the enabled signals are Port 1, and pins from 1-5, 7, and 9-32 assigned to the various signals...
At any rate, back to the original issue, anyone have an idea why the script isn't resetting the Zero Z DRO?
Thanks!
-
Are you using a motion controller? If so, which one? Sounds like your motion controller isn't handling probing correctly.