Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: AdrianH on June 15, 2017, 07:58:09 AM
-
Posting in lunch break at work so hope I can get the problem described correctly.
Mach3 licensed, on a CNC Plasma cutter, I use a Macro M800.M1s and call this as part of Sheetcam output Gcode before every pierce.
On some occasions, when some piece of metal has decided to jam things up I can find that the head is raised and the probe is already active before I call G31, so I get a message to say Probe input ignored and Mach3 then for some reason starts to move the X, Y or Z erratically which means I then loose position and have to stop the cutter, sort out positions and recommence cutting.
So the idea I has was on my M800.m1s check to see if the probe was active before doing a G31, but I can not get it to work, so not sure where I am going wrong.
Here is my M800 code as it is now and how I thought I could get it to work, can someone point me to my errors?
' APH
Code "G31 Z-30.0 F300" 'probe surface
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
Sleep(100)
Wend
ZprobePos = GetVar(2002) 'get contact point
Code "G0 Z" &ZprobePos 'return to point to remove overshoot
' Wait For movement To complete
While (IsMoving())
' Sleep, so other threads can run While we wait
Sleep(100)
Wend
Call SetOEMDRO(802, -1.80) 'Set Z DRO = 0.00
Code "G1 Z 3.0 F300"
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
Sleep(100)
Wend
' End
and new attempt is
' APH
' Update 15/06/17
If GetOEMLED(825) = 1 Then ' The digitise LED is already on
Message " Probe input active"
Code "M1" ' Code out the M1 to stop the machine if set to allow
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
WEND ' Wait end
ELSE
Code "G31 Z-30.0 F500" 'probe surface
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
Sleep(100)
Wend
ZprobePos = GetVar(2002) 'get contact point
Code "G0 Z" &ZprobePos 'return to point to remove overshoot
' Wait For movement To complete
While (IsMoving())
' Sleep, so other threads can run While we wait
Sleep(100)
Wend
Call SetOEMDRO(802, -3.60) 'Set Z DRO = 0.00
Code "G1 Z 2.5 F500"
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
Sleep(100)
Wend
' End
End if
Cheers
Adrian
-
I am trying a few more things without success such as defining a variable at the beginning called Ptest
I have tried to Dim as Integer and the following as below without winning.
I am not getting the message in the status window that the probe is active so I am assuming that the GetOEMLED(825) is the same as G21 and activates the probe, it self to still cause the issue, so will look to see if there is a way just to read the input pin directly?
' To find top of work and not screw ARC's
' Lots of tries
' APH
' Update 15/06/17
SetVar(Ptest,GetOEMLED(825))
If Ptest = 1 Then ' The digitise LED is already on
Message "Probe input active" ' notify
Code "M1" ' Code out the M1 to stop the machine if set to allow
While (IsMoving()) ' Wait for movement to complete
Sleep(100) ' Sleep, so other threads can run while we wait
WEND ' Wait end
Else ' probe not set
Code "G31 Z-30.0 F500" ' probe surface
While (IsMoving()) ' Wait for movement to complete
Sleep(100) ' Sleep, so other threads can run while we wait
Wend ' Wait end
ZprobePos = GetVar(2002) ' get contact point
Code "G0 Z" &ZprobePos ' return to point to remove overshoot
While (IsMoving()) ' Wait For movement To complete
Sleep(100) ' Sleep, so other threads can run While we wait
Wend ' Wait end
Call SetOEMDRO(802, -3.60) ' Set Z DRO = 0.00
Code "G1 Z 2.5 F500" ' go to just above pierce height
While (IsMoving()) ' Wait for movement to complete
Sleep(100) ' Sleep, so other threads can run while we wait
Wend ' Wait end
End If ' End
Food time back later.
Adrian
-
OK Success, I was not correctly understanding the IF Then Else bit on testing for condition, I do not go: If GetOemLed(825) = 1
I just go: If GetOemLed(825)
as in the following works:
' APH
' Update 15/06/17
If GetOemLed(825) Then ' The probe LED is already on
Message "Probe input active" ' notify
Code "M1" ' Code out the M1 to stop the machine if set to allow
While (IsMoving()) ' Wait for movement to complete
Sleep(100) ' Sleep, so other threads can run while we wait
WEND ' Wait end
Else ' probe not set
Message "" ' clear message
Code "G31 Z-30.0 F500" ' probe surface
While (IsMoving()) ' Wait for movement to complete
Sleep(100) ' Sleep, so other threads can run while we wait
Wend ' Wait end
ZprobePos = GetVar(2002) ' get contact point
Code "G0 Z" &ZprobePos ' return to point to remove overshoot
While (IsMoving()) ' Wait For movement To complete
Sleep(100) ' Sleep, so other threads can run While we wait
Wend ' Wait end
Call SetOEMDRO(802, -3.60) ' Set Z DRO = 0.00
Code "G1 Z 2.5 F500" ' go to just above pierce height
While (IsMoving()) ' Wait for movement to complete
Sleep(100) ' Sleep, so other threads can run while we wait
Wend ' Wait end
End If ' End
Adrian
-
Good to see you figured it out!