Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Tarak on March 18, 2007, 01:33:25 AM

Title: How to make the machine not operate unless it is homed first...
Post by: Tarak on March 18, 2007, 01:33:25 AM
Is it possible to make the machine not operate unless it is homed after switching on power?
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Brian Barker on March 21, 2007, 09:51:39 PM
Yes you can do that in the Macro pump... you just need to look at the Ref Led and tell the system to error out if i is asked to run a Gcode file.
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Tarak on April 13, 2007, 02:28:20 AM
Hi Brian, thanks for the reply (sorry it's taken me so long).
I've been reading up on the Macro pump and now I understand what it is and how it works.
I looked at the LED I need to check and it's OEM code 808.
I'm just having a try at coding it at the moment.
Thanks.
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Hood on April 13, 2007, 09:29:29 AM
OOPS I posted this in the wrong thread, thats what happens when you get older ;)
Hood
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Tarak on April 15, 2007, 09:36:49 PM
If you get a chance could you please have a look at the code I'm trying to write, it keeps giving me a syntax error, but hey I've got to start somewhere....

If GetLED (808) = 0 'Std Y axis home LED
Sub DoButton (2082) 'Not sure if this number is correct, it says in the manual that this is the scan code (I'm just using the standard STOP-Esc)
CODE "(HOME MACHINE BEFORE USE)" 'I thought this way it would flash, because it is technically an error with the brackets.
End If

CODE "(MACHINE READY FOR USE)"
CODE "G90 G54"
CODE "G00 Y1.0"
CODE "M03"
CODE "G01 Y20.0 F70"
CODE "G90 G00 Y5.0"
CODE "M05"
CODE "M30"
Title: Re: How to make the machine not operate unless it is homed first...
Post by: zealous on April 16, 2007, 07:34:26 AM
Don't forget if you have a "If" statment you need an  "Else".

Look out for that VB editor, it doesn't seem to want to save scripts and is acting wird  :P bet Brain if fixing that now  ;D

This should work fine, some one might have a better way than this please post  :)

If GetLed (808)=0 Then 'Std Y axis home LED

DoOEMButton (1021) 'Estop OEM LED
CODE "(HOME MACHINE BEFORE USE)"


Else

CODE "(Ready to go)"

End If
Title: Re: How to make the machine not operate unless it is homed first...
Post by: zealous on April 16, 2007, 08:35:39 AM
Darc,
Acualy after testing the code out I found that since the estop is active I'm unable to Home the axis (obviously  ;D) via the macro pump.
If your trying to not allow the operator to run Gcode you could put the above code on the Gcode button and add the "DoButton (0) 'Play Gcode" and add "DoOEMButton(290-295) to disable jog movment of each axis".

PS I belive we're looking for a =0 value is sent if the axis are ref home

Put this on the Start Gcode button:

If GetLed (808)=1 Then 'Std Y axis home LED

DoOEMButton (1021) 'Estop OEM LED
CODE "(HOME MACHINE BEFORE USE)"

Else
DoButton (0) 'Strat Gcode
End If


Put this in the macro Pump:
If GetLed (808)=1 Then 'Std Y axis home LED

DoOEMButton (250) 'Stop Jog X
DoOEMButton (251) 'Stop Jog Y
DoOEMButton (252) 'Stop Jog Z
DoOEMButton (253) 'Stop Jog A
DoOEMButton (254) 'Stop Jog B
CODE "(HOME MACHINE BEFORE USE)"


Else
DoOEMButton (290) 'Allow Jog X
DoOEMButton (291) 'Allow  Jog Y
DoOEMButton (292) 'Allow  Jog Z
DoOEMButton (293) 'Allow  Jog A
DoOEMButton (294) 'Allow  Jog B

CODE "(Ready to go)"

End If



If a talented VB coder would add in a "SUb Main" and "Sub exit" to have it exit the macro pump script once the Axis are homed that would be great  ;D since there is no reason for Mach to keep check the code once the axis are refered.
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Brian Barker on April 16, 2007, 09:35:58 PM
This will do it... You just need to change the UserLED to some other LED...

Sub Main()'//this must be at the start of the function

 If (GetUserLED (1100)= true)Then'//something to show that you don't need to run the Macro
 Exit Sub'//Get OUT and don't run the code!
 End If
 
 
If GetLed (808)=1 Then 'Std Y axis home LED

DoOEMButton (250) 'Stop Jog X
DoOEMButton (251) 'Stop Jog Y
DoOEMButton (252) 'Stop Jog Z
DoOEMButton (253) 'Stop Jog A
DoOEMButton (254) 'Stop Jog B
CODE "(HOME MACHINE BEFORE USE)"


Else
DoOEMButton (290) 'Allow Jog X
DoOEMButton (291) 'Allow  Jog Y
DoOEMButton (292) 'Allow  Jog Z
DoOEMButton (293) 'Allow  Jog A
DoOEMButton (294) 'Allow  Jog B

CODE "(Ready to go)"

End If

End Sub'//This is the End of the SubMain function

Main'//Put this at the end of the code file
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Tarak on April 16, 2007, 09:55:54 PM
Thanks Zealous & Brian, holy crap that's confusing, I'll give it a go today.
I thought most people would want to use this function, just for safety.
Thanks again.
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Tarak on April 17, 2007, 02:31:27 AM
Hey guys, I tried to use both of them, but I think I was doing something wrong, cause I couldn't get it to work properly.
Interestingly enough after I tried those, I gave up & unchecked use MacroPump and remove the code from within the button I was testing it on.
Now for some reason my spindle will not start up using the CODE "M03" in my scripts.
When I press ESC (cycle stop) during the cycle of the script, the spindle starts up???????
But if I load a normal G code program the spindle works fine with M03.....
Well I've done it this time.....
Title: Re: How to make the machine not operate unless it is homed first...
Post by: zealous on April 17, 2007, 09:48:25 AM
Strange....I'll have to try out Brains cool code,I'll have alook at it but I do Action script  ;D any VB master this will be easy for them
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Tarak on April 17, 2007, 05:24:33 PM
Sorry for the false alarm guys, I figured out what was causing the problem, it's a piece of code that times how long for a particular axis movement.
see here.... http://www.artsoftcontrols.com/forum/index.php?topic=2951.0
I'll talk to poppabear about it, see if he can let me know what's happening.
I'll remove the code that was giving me grief and retry this script.
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Tarak on April 17, 2007, 06:05:34 PM
Well I tried to get this routine to work, but it keeps giving me a syntax error,so obviously I haven't entered it in correctly, if possible could you guys have a look at it and let me know where I'm going wrong? Thanks

‘This is the code from one of my buttons
Sub Main()
If (GetUserLED (1100)= true) Then  ‘Can I use the light for the Referenced Y axis (808)
CODE "G90 G54"
CODE "G00 Y1.0"
CODE "M03"
CODE "G01 Y20.0 F70"
CODE "G90 G00 Y5.0"
CODE "M05"
CODE "M30"
Exit Sub
End If
Main



‘This is the code in my Macropump.m1s
If GetLed (808)=1 Then 'Std Y axis home LED
DoOEMButton (251) 'Stop Jog Y
CODE "(HOME MACHINE BEFORE USE)"

Else
DoOEMButton (291) 'Allow  Jog Y
CODE "(Ready to go)"

End If

End Sub
Title: Re: How to make the machine not operate unless it is homed first...
Post by: Graham Waterworth on April 18, 2007, 03:16:55 AM
Try it like this

If GetLED (808)= 1 Then
  CODE "G90 G54"
  CODE "G00 Y1.0"
  CODE "M03"
  CODE "G01 Y20.0 F70"
  CODE "G90 G00 Y5.0"
  CODE "M05"
  CODE "M30"
  While IsMoving()
  Wend
End If

Graham.