Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: Duc748 on October 22, 2010, 01:58:37 PM
-
Hi All,
Is it possible to have a manual button on the gantry to do a z auto zero, instead of using mach3 zero button??
When doing tool change I think it would be better to have button on the gantry rather than going back to pc to do it.
If its possible is their anyone prepared to give me advice and directions on how to implement this?
Rick
-
I do a similar kind of thing, in as much as I run macros via external buttons. Scott Scheafers MachMad plugin allows you to assign a User LED to a macro and when the LED is seen the plugin will run the macro that you have designated.
So what you would do is have your autozero named as a macro ( eg m1234.m1s) and placed in your profiles macro folder. You would then set up the plugin to look out for your LED and tell it the macro to run.
You could also likely do this via a macropump, just have the macropump look for a LED and then do the macro when its seen.
Hood
-
Thanks Hood,
Do you have a simple macro for this you like to share?
I read so many posts with different operations like is the probe conneted.. although they seem good ideas all I want is something very simple to get the job done.
Rick
-
Afraid I dont use auto zero so dont have a macro but a search of the forum will bring up plenty I am sure.
I use external buttons to activate other things such as Cycle Start, Ref All etc.
Hood
-
Hood's advice to use MachMad is good. It only costs $10. Then you can have all sorts of remote triggers.
However if you want to do it this way, here is a copy of an old post of mine regarding having a manual button for a macro.
====================================================================
A brain can not trigger a macro on it's own. So the macropump does that.
However brains are a no brainer to implement safety timers and lockouts. (pun intended) ;D
The auto tool zero macro needs to be placed in the macro folder with the name of your profile. Eg. Mach3Mill. Call it M615.m1s
The macropump calls the relevant macro when a user LED goes active.
It basically is one which Poppabear wrote for me a while ago. Much the same as posted above.
The brain sets the LED when the switch is pushed and held for 1.5 seconds but only if there is no motion, the spindle is not running and reset is not active.
Being an external momentary switch I think the 1.5 second delay is a good safety measure.
This means you must push and hold the switch for 1.5 seconds before anything will happen.
You do not want unintentional activation of the macro.
So the addition of the brain is just to allow for easy implementation of the safety lockouts.
====================================================================
Have the momentary switch activate OEMTRIGGER#5
Remove any initial delay in the auto tool zero script. The brain now handles that.
Try it if you wish,
Greg
-
Hi Greg,
I am running a twin Z axis machine (Z and A axis) with external zero buttons for both axis, can you please advise on what additional code I need to add to the macropump? I have 2 separate Macros M615 and M616 one for each axis in the macro folder but unsure regarding the macro pump.
Rick
-
Rick
Just duplicate what is in the macropump as follows. (duplicated section in blue). This time using DRO and LED 1141 and M616
A = GetOEMled (1140)
B = GetUserDRO (1140)
If A And (B = 0) Then
Code "M615"
SetUserDRO(1140,1)
End If
If Not A And (B > 0) Then
SetUserDRO(1140,0)
End If
C = GetOEMled (1141)
D = GetUserDRO (1141)
If C And (D = 0) Then
Code "M616"
SetUserDRO(1141,1)
End If
If Not C And (D > 0) Then
SetUserDRO(1141,0)
End If
Then edit the trigger brain to duplicate what is already in the brain. Make the first input of the duplicated section, OEMTRIGGER#6 and terminate with OEMLED: 1141
So M615 will be for Axis Z, and M616 will be for Axis A.
That should work.............I think. ;D
Greg
-
I'm probably missing something here, but isn't it easier just to use triggers? i.e. with no macropump, macros, brains or plugins needed.
Ian
-
That's what I was thinking. As long as you have a button for it, just use an OEM Trigger.
-
No doubt there are lots of ways you can do this. Using MachMad would be easy.
As I understand it you cannot activate a macro with an OEMtrigger. With the exception of the one "Trigger Macro" which first must be set in the init string.
I guess with some clever macro writing you could run a tool zero routine for the appropriate Z or A axis, all contained within the trigger macro.
Why I use a brain is because the safety lockouts and time delay can be done very easily.
Greg
-
But can't you activate an onscreen button that calls a macro? Or that doesn't work?
-
I don't believe that you can. Could be wrong.
It was a long time ago that I looked into this.
Greg
-
I guess I was just making the point that as far as Duc748's particular requirement here, there's no need for any macros (or macropump) at all in the first place, so how to fire one is not really an issue.
However, if you DID want to use a trigger macro that handled multiple triggers, then it just requires a "select" statement so is not really that comlex.
Anyway - JMHO
Cheers
Ian
-
I guess I was just making the point that as far as Duc748's particular requirement here, there's no need for any macros
I think the question was about triggering an auto tool zero routine, which is a macro.
Hi Greg,
I am running a twin Z axis machine (Z and A axis) with external zero buttons for both axis, can you please advise on what additional code I need to add to the macropump?
I have 2 separate Macros M615 and M616 one for each axis in the macro folder but unsure regarding the macro pump.
And yes I am sure with a bit of clever macro writing it could all be handled in the trigger macro.
However Rick has been using this macropump/brain combination method for a while and asked how he could extend it to cover dual Z axis. Hence my reply.
Greg
-
Well thanks for all the input,
I have implemented this as Gregs method based on the fact that the Brain has the safety feature of holding the button for 2 seconds for activation..I think this is important as people do push buttons..ah whats this for..you get my meaning.
The trigger macro does interest me too..is it possible to have the safety feature built into this method?
thanks again
Rick
-
Hi Rick - can you clarify whether you're talking about an "auto tool zero" or just about zeroing the axis as per the standard Z and A zero buttons please?
Cheers
Ian
-
Hi Ian,
The machine is configured as auto zero tool buttons with touch off plate.
Rick
-
OK Rick and Greg - I misunderstood the requirement - Mea culpa.
However Rick if you do want to have a go via a trigger macro then yes you should be able to code in any safety features you like. See http://www.machsupport.com/forum/index.php/topic,15120.msg101160.html#msg101160 (http://www.machsupport.com/forum/index.php/topic,15120.msg101160.html#msg101160) where if for example you put a "sleep 1000" as the first line of the example code, it would test whether you held the button that fired the trigger for more than a second before doing whatever.
Ian
-
Ian
The advantage of using a brain is the timer safety. If the switch/button is held for less than the specified time (2 sec) then nothing happens.
Can you give us an example of how to do this in the trigger macro. It would be very handy to know how this is done.
Would it be an if/then with a pause and recheck input?
Greg
-
Greg,
Ive been testing my setup today, I noticed that nothing happens for 2 seconds as my input into the Brain, but if I try the auto zero again it starts as soon as the button is pressed and no 2 second delay.
You have any idea what ive done wrong?
Rick
-
No I don't Rick. Have not had anyone else report that. Does it happen for both Z and A auto tool zero buttons?
Perhaps if it is the second section of the brain that you added, it may be that the timer module is set differently. Not set as one shot maybe.
It might be worth waiting on Ian to show how this can all be done in a trigger macro. It would be more elegant.
Greg
-
Rick
Here is the brain as described earlier. Using OEMtrigger # 6 and OEMLED 1141
Try this and see if the result is the same.
Greg
-
Ian
The advantage of using a brain is the timer safety. If the switch/button is held for less than the specified time (2 sec) then nothing happens.
Can you give us an example of how to do this in the trigger macro. It would be very handy to know how this is done.
Would it be an if/then with a pause and recheck input?
Greg
Hi Greg - see my suggested example in my previous post. FWIW using the macro method I don't think there's a need for checking IsMoving and Enable like in your Brian because Mach ignores macro generated movement whilst already in motion and doesn't execute macros whilst in reset. That would just leave your spindle check which could be done the macro equivalent way as the Brian i.e. by checking LED 116.
So my example macro 666.m1s above might look something like this: (change trigger #s to suit)
'wait before doing checks so that a trigger must still be active after 2 secs for the following to succeed
sleep 2000
'if T1 is still active i.e. button is still pressed after 2 secs and spindle is off
If isActive(OEMTRIG1) and not getOEMLED(116) Then
'paste your Z axis tool setting code here
End If
'if T2 is still active i.e. button is still pressed after 2 secs and spindle is off
If isActive(OEMTRIG2) and not getOEMLED(116) Then
'paste your A axis tool setting code here
End If
Let me know how you get on.
Cheers
Ian
-
Thanks Ian. I get the general idea. Gives me something to work on.
You can't call a macro from a macro....can you?
Greg
-
You can't call a macro from a macro....can you?
Well.... you can, but there be dragons. Best avoided.
Ian