Zero to work height issues and my macro solution.

Mach3 and Mach4 questions, tips and topics can be posted here
Post Reply
AdrianH
2 Star Member
2 Star Member
Posts: 87
Joined: Tue Dec 27, 2016 1:08 pm

Zero to work height issues and my macro solution.

Post by AdrianH »

I am not sure if this will help anyone or, if the issue I had is only particular to me, but here goes.

On occasion, my switch used on the G31 probe would stick, either due to crud that had managed to get in there or something had jammed in there keeping the torch raised slightly, basically meaning the digitise input was active before I zero'ed for a cut.

When this happened Mach3 would sort of hang for a while, then output a message to say Probe ignored, but then the axis would actually move at a very slow rate and the DRO's go at a different rate. It meant that I would need to hit stop, remove the obstruction and then try and reset the position back up on the table as it was prior to the zero heigh macro.

Anyway, not knowing why Mach3 did as it did, I have changed my macro M800.m1s to the one below, It will check for active probe before doing the zero action, if Active it does an "M1" to stop everything and sticks a message in the status window, but at least it does not then go on to move the axis around, giving me the chance to remove the obstruction, back step a line and try again.

Code: Select all

' Adrian Hodgson M800.m1s
' Update 15/06/17 revised 16/06/17
APH = 2.50			' Define Above Pierce Height
HA = -3.6			' Define the Height Adjustment

If GetOemLed(825) Then		' The probe LED is already on
   Code "M1"				' Code out the M1 to stop the machine if set to allow
   Message "Probe input error!"	' notify
Else						' probe not set
   Message ""				' clear message
   Code("G31 Z-30.0 F600")		' 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, HA) 	' Set Z DRO = 0.00
   Code("G1 Z "& APH &" F600")	' 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 
If it helps anyone, I have managed a bit, if not, nothing lost!

Adrian
tcaudle
4 Star Elite Contributing Member
4 Star Elite Contributing Member
Posts: 1353
Joined: Tue Feb 28, 2012 6:47 pm

Re: Zero to work height issues and my macro solution.

Post by tcaudle »

This si a Macro we have been including for MACH profiles for several years:

M900

'code to stop a touch off if the Ohmic is stuck on
if IsActive(8) then
Response = MsgBox ("Touch - Off sensor jammed. Clear and hit RUN to continue ", 4 , "Clear Z Jam")
code "M00"
end if

You then do an M900 call in the OnReference Function in SheetCAM so when it starts a reference it first checks the input and stops until you clear it. Simple and elegant.
tcaudle
4 Star Elite Contributing Member
4 Star Elite Contributing Member
Posts: 1353
Joined: Tue Feb 28, 2012 6:47 pm

Re: Zero to work height issues and my macro solution.

Post by tcaudle »

Works with any input used for touch off but it may need to be renumbered
AdrianH
2 Star Member
2 Star Member
Posts: 87
Joined: Tue Dec 27, 2016 1:08 pm

Re: Zero to work height issues and my macro solution.

Post by AdrianH »

OK, so you include this with your CandCNC gear, sorry I did not know. Mine is all home made so I am learning to resolve issues as I go along.

I looked at the IsActive() but could not find anything that defined the probe input pin (Port 1 Pin 11) when reading though the macro reference manual, have I missed it? where is the defs?

Also just reading through the Sheetcam resource Post.html I have, there is no function listed I can see called OnReference. So I am assuming you have been at this for a few years and have gained a lot of knowledge including writing your own functions. It will probably take me some time to catch up if ever.

Can I ask if Mach3 moving the axis if 'Ohmic' is stuck is a known thing, or just on mine?

Adrian
AdrianH
2 Star Member
2 Star Member
Posts: 87
Joined: Tue Dec 27, 2016 1:08 pm

Re: Zero to work height issues and my macro solution.

Post by AdrianH »

Hello tcaudle, or anyone!
I am reading more resources and trying to learn. I found this on the web
http://www.machsupport.com/Mach3Wiki/in ... gnal_Names

Are you using these numbers for Ohmic, in effect using what would be using ZHome for Ohmic and possibly using the DIGITIZE 22 as a back-up on a switch?

Just trying to understand where the 8 came from.

Adrian
tcaudle
4 Star Elite Contributing Member
4 Star Elite Contributing Member
Posts: 1353
Joined: Tue Feb 28, 2012 6:47 pm

Re: Zero to work height issues and my macro solution.

Post by tcaudle »

Open the MACH WIKI and look at how you can call things like DRO's, Buttons and test the state of inputs and outputs. the number is a shorthand parameter and the cross list is in the WIKI. Each outputs and input FUNCTION (like Z home ) has a number. Which physical input you assign to it is up to the input mappings

http://www.machsupport.com/Mach3Wiki/in ... gnal_Names

The input being tested is Z home (Probe input is mapped to both Probe and Z home). Z home mapped to the same input as Probe.
AdrianH
2 Star Member
2 Star Member
Posts: 87
Joined: Tue Dec 27, 2016 1:08 pm

Re: Zero to work height issues and my macro solution.

Post by AdrianH »

OK thanks that is the document I found last night later on in the evening. Just needed to confirm.

It gives me a bit more information to play with and use in the future.
Your table users must be pleased with your knowledge.
Have fun
Adrian
tcaudle
4 Star Elite Contributing Member
4 Star Elite Contributing Member
Posts: 1353
Joined: Tue Feb 28, 2012 6:47 pm

Re: Zero to work height issues and my macro solution.

Post by tcaudle »

45+ years of Electronics and Electronic Design
25+ years Computer and Software Applications /Programming
35 + years CNC and power electronics
15+ years with DIY and Entry Level CNC
15 + years CNC Plasma and THC design
15+ years Windows/MACH back to Master 5 on WIN98
9 years with SheetCAM and LUA Post language
2+ years with LINUX and LINUXCNC

If you do things long enough and often enough you start to learn things! :D
Post Reply

Return to “Mach3 & Mach4 CNC”