Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Gregor77 on December 06, 2014, 11:32:21 AM

Title: Rotaryaxis reference
Post by: Gregor77 on December 06, 2014, 11:32:21 AM
Hi all,

to reference Z, X, Y and A I use a macro (see below).

The A is a rotational axis, sothe refrence switch can be active when starting the refrence run.
I check it with "If getoemled(839) Then".
If active, then I would like to rotate the axis by some degrees, and do the refrence run after that.
Simple so far.

But often it doesn't work.
I think I have towait until the move is done with the famous IsMoving function.
See "'*" in the macro.
If the IsMoving is in the macro, Mach3 hangs.

What can be the reason, and how to avoid it?

Greetings,
Gregor




'ref Z first
DoOEMButton(1024)

'ref XY
RefCombination(3)

'check for active switch
If getoemled(839) Then
code("G91 G0 A-14")
'*While IsMoving()
'*Wend
End If

DoOEMButton(1025)

'code("G90 G53 G0 A47")
Title: Re: Rotaryaxis reference
Post by: mc on December 06, 2014, 03:51:55 PM
Macros are pretty slow to respond to inputs (should be a 10Hz refresh rate), so are not really suited for homing routines or anything that requires critical timing.

The homing routines work far quicker, however I have no idea how you implement them for an A-xis.
Title: Re: Rotaryaxis reference
Post by: BR549 on December 06, 2014, 04:44:49 PM
Give this a try.

' Macro for Homing Machine
Dobutton(24)   ' Reference Z
While Ismoving()
Sleep(10)
Wend

DoButton(22)   'Reference X
While Ismoving()
Sleep(10)
Wend

DoButton(23)   'Reference Y
While Ismoving()
Sleep(10)
Wend

If GetLED(39) Then    'Check for A home LED IF so then

   Code"G91"
   Code"G0 A-45"
   Code"G90"
   While Ismoving()
   Sleep(10)
   Wend
   DoButton(25)
   While Ismoving()
   Sleep(10)
   Wend

Else         'Other wise reference A
 
   DoButton(25)
   While Ismoving()
   Sleep(10)
   Wend
   
End If

End
 


(;-) TP
Title: Re: Rotaryaxis reference
Post by: Gregor77 on December 06, 2014, 05:33:53 PM
> Give this a try.
> ' Macro for Homing Machine

Wow, works exactly as expected and reliable.
Even with the positioning after A reference (code("G90 G53 G0 A47")).

Any explanation why RefCombination does not work?
Not so important, just curious.

Thank you,
Gregor



Title: Re: Rotaryaxis reference
Post by: BR549 on December 06, 2014, 07:16:20 PM
It never really did work dependably (;-)  The long hand versions of most functions always worked well in the past.

(;-) TP