Hello Guest it is February 27, 2021, 08:28:08 PM

Author Topic: Custom Homing Code  (Read 2822 times)

0 Members and 1 Guest are viewing this topic.

Custom Homing Code
« on: April 05, 2013, 12:27:53 PM »
Hi all
I did this piece of code that is attached to the "Ref All Home" button. I have a tangential knife on the rotary (A) axis that has to be locked by a pin and then zeroed.
This code does not work on first startup of Mach. If I traversed the a axis once, then it will work. It seems to sit and wait for the first turn to complete but it does not turn at all. I think it hase something to do with feed rates.
Can someone help please?

DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
While ismoving()
Wend

Code "G1 A0 F2000"
While ismoving()
Wend

ActivateSignal(Output2) 'set the pin
Sleep(500)

Code "G1 A-180 F2000"  ' turn the knife anti-clockwise for a half turn
While ismoving()
Wend

DoButton(11)  ' clear the DRO

Code "G1 A-180 F2000"  'turn the knife again to make sure of one full turn and lock-up
While ismoving()
Wend

DoButton( 11 )  ' do the mach referencing

SetDro(3,270) ' to head the knife in th eright direction
DeActivateSignal(Output2) ' unlock the pin
Code "G0 A0"
Code "G0 X-12"
Code "G0 Y102"
While ismoving()
Wend
DoButton( 8 )
DoButton( 9 )

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Custom Homing Code
« Reply #1 on: April 05, 2013, 05:15:55 PM »
Seems to be working fine here, what version of Mach are you using? also if you attach your xml I will test and see if it works fine with it.
Hood
Re: Custom Homing Code
« Reply #2 on: April 06, 2013, 02:02:09 AM »
Hi Hood,
I am using the latest downloadable version. Not sure of the numbers now as I am not with the machine.
I attached the xml.
I was wondering if I should not use functions like SetFeedRate() instead of trying to set the feedrate with the Gcode.

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Custom Homing Code
« Reply #3 on: April 06, 2013, 04:28:36 AM »
It may be the version of Mach you are using as I know it has issues and issues with homing is one. I would suggest you try an older version, 056/057 work well for me but some people say 062 is also ok.
 Hood

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Custom Homing Code
« Reply #4 on: April 06, 2013, 04:40:47 AM »
Ok I have just loaded 067 (Dev version) and it will not even work with your xml so definitely an issue there. 066 as I mentioned also has problems and in my opinion should not be on the site for download as the lockdown.
Hood
Re: Custom Homing Code
« Reply #5 on: April 14, 2013, 02:41:52 AM »
Do you know where the button script is stored?

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Custom Homing Code
« Reply #6 on: April 14, 2013, 05:17:57 AM »
answered in your other post.

Hood