Hello Guest it is April 26, 2024, 03:13:34 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - gnorton

Pages: 1
1
VB and the development of wizards / IsMoving Hangs Mach3
« on: July 18, 2014, 05:26:25 PM »
Hello All,

I have a custom version of a Z zeroing macro I found here.  For some reason one of the IsMoving loops hangs Mach3 when it executes.  The only way I can regain control is to hit the reset button in mach.  The last message I see is "Retracting Probe to touch depth" and it never comes out of the IsMoving loop as "Retract Complete" never shows up.  Anyone have thoughts on this?  I am running version 066 (latest - just downloaded).  I am calling the script from the Set Z Height button on the Offsets tab.  Any input is greatly appreciated.

Thanks.
Greg

Code: [Select]
DownStroke = -0.5 'Set the down stroke to find probe
DownFeedRate = 10 'Set the down FeedRate
RetractStroke = 0.5 'Set the retract Stroke
RetractFeedRate = 40 'Set the retract FeedRate
PlateThickness = 0.060

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
' Not getting correct value for PlateThickness - hard coded for now
' PlateThickness = 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 G31 Z" &DownStroke &" F" &DownFeedRate 'probing move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the axact point the probe was hit
If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Code "(Retracting Probe to touch depth)"
Wend
Code "(Retract Complete)"
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 Z" &RetractStroke &" F" &RetractFeedRate 'retract
While IsMoving ()
Wend
Code "(Z axis is now zeroed - hard coded to " &PlateThickness &")" 'puts this message in the status bar
Else
Code "G0 Z0" 'retract to start pos
While IsMoving ()
Wend
Code "(Z-Plate not found, check connection or stroke - try again)" 'puts this message in the status bar
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
Code "F" &CurrentFeed 'Returns to prior feed rate
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     


2
General Mach Discussion / Touch Off Macro Half Works
« on: August 19, 2012, 01:44:53 PM »
I've got a touch off plate, but the software only half works.  By this I mean the tool comes down and stops when it touches the plate, but it does not then retract and it does not set the Z height.  Also, after running this macro I cannot manually jog the machine until I reset it.  Can someone point out what I'm doing wrong?  I "borrowed" this macro code from these forums (thanks to whomever wrote it).  The code seems OK to me.

Thanks.
Greg

Code: [Select]
'Tool Zero Setting Macro

' Change the following three lines to suit your machine
PlateThickness = GetOEMDRO(1001) ' Thickness of touch plate
RetractClearance = 0.100 ' Clearance above touch plate to retract to
ProbeFeed = 5      ' Feedrate to use for probing

' Define some constants
ZDRO = 2      ' Z Axis DRO
AbsoluteModeLED = 48   ' Absolute Coordinate Mode LED
IncrementalModeLED = 49   ' Incremental Coordinate Mode LED
FeedrateDRO = 818   ' OEM code for feedrate DRO
ProbeLED = 825      ' OEM code for probe input LED
ZTouchDRO = 2002   ' OEM code for DRO that holds Z touch position

' Do nothing if probe is already grounded
If GetOemLed(ProbeLED) = 0 Then

   ' Wait a few seconds for user to get touchplate in place
   Code "G4 P2"
   
   ' Save current feedrate
   CurrentFeed = GetOemDRO(FeedrateDRO)
   
   ' Save current coordinate mode
   AbsMode = GetOemLED(AbsoluteModeLED)

   ' Set absolute coordinate mode
   Code "G90"

   ' Zero Z DRO
   Call SetDro (ZDRO, 0.0000)

   ' Pause for DRO to update
   Code "G4 P0.5"

   ' Do the touch move
   Code "G31 Z-0.5 F" & ProbeFeed

   ' Wait for it to complete
   While IsMoving()
   Wend

   ' Delay a bit for Huh
   Code "G4 P0.25"

   ' Get the Z position where probe input triggered
   ZProbePos = GetVar(ZTouchDRO)

   ' Go back to touch position (G31 backs off after touch)
   Code "G0 Z" & ZProbePos

   ' Wait for it to complete
   While IsMoving ()
   Wend

   ' Set Z DRO to touch plate thickness
   Call SetDro (ZDRO, PlateThickness)

   ' Pause for DRO to update
   'Code "G4 P0.5"

   ' Retract Z to SafeZ, if enabled, else to RetractClearance above plate
   If(IsSafeZ() = 1) Then
      SafeZ = GetSafeZ
      If  SafeZ  > PlateThickness Then
         GotoSafeZ()
      End If
   Else
      RetractHeight = PlateThickness + RetractClearance
      Code "G0 Z" & RetractHeight
   End If
   
   ' Tell user we're done
   Code "(Z axis is now zeroed)"

   ' Reset feedrate to original value
   Code "F" & CurrentFeed
   
   ' Reset coordinate mode to original value
   If AbsMode = 0 Then
      Code "G91"
   End If
Else
   Code "(Z-Plate is grounded, check connection and try again)"
End If

Exit Sub

3
General Mach Discussion / Need Help w/ Encoder Interface
« on: July 29, 2012, 08:25:26 PM »
Hello All,

I've got a new Romaxx WD-1 and I am unable to get the encoder interface working in Mach.  The symptom is that none of the encoder DROs will ever change when I move the Z (or any other) axis.  I followed debug instructions posted here:

http://romaxxcnc.proboards.com/index.cgi?board=support&action=display&thread=447

This showed me that there are pulses present on the parallel port connector at the interface to the PC for at least the Z axis encoder (I only tested one).  The only thing that didn't match these instructions was that the pulse voltage was about 4v instead of 5v, but I'm thinking this should still work.  From this I'm thinking that the problem is somewhere in Mach and/or the PC hardware side of things.  For what it's worth, the 1st parallel port is working perfectly, my machine runs fine - just no encoders.  As far as I can tell, both ports are using the same driver, and I have them enabled in Mach (see attached screen shots) with the correct addresses.

I'm also attempting to set up a touch off plate, but this is also not working, I suspect for the same reason.  It also uses the 2nd parallel port.

Does anyone have a suggestion?  Any input is greatly appreciated.

Thanks.
Greg

Pages: 1