Hello Guest it is October 23, 2021, 01:28:17 PM

Author Topic: Mach3turn spindle and c-axis macro  (Read 207 times)

0 Members and 1 Guest are viewing this topic.

Mach3turn spindle and c-axis macro
« on: September 01, 2020, 08:56:26 AM »
Hi,

Been reading a lot on this forum and always found help to my problems, but this time I can't so I hope for some help - just registred, thanks.

I have build a new cnc machine - a lathe with atc and c-axis, the spindle motor is always connected to the spindle, and I have an electric clutch to engage a nema 34 motor, everything works I can pull output3 and the clutch engage, so I have made a button to enable C-axis that stops the spindle (if running) short pause and enables the clutch - working. Electrical it's blocked, if I enable the clutch it removes the enable signal to the vfd so both cannot run at the same time. I have changed the m3 (and m4) macro to:

If IsActive(OUTPUT3) Then
   While IsMoving()
   Wend
   DeactivateSignal(OUTPUT3)
   Sleep(250)
   DoSpinCW()
Else
    DoSpinCW()
End if

so if the output3 is active it wait if any movement and then swith off output3, pause and spindle start... if output3 is not active it should not waste time and just start the spindle...

but it always jump to start the spindle right away, even if output3 is enabled?

hope someone can point me in the right direction.


Regards Morten
Re: Mach3turn spindle and c-axis macro
« Reply #1 on: September 01, 2020, 12:07:18 PM »
Solved it...

if other people should have the same problem I solved it by changing to output 4 and used GetOEMLed instead, so it looks like this:

If GetOEMLed(77) Then
   While IsMoving()
   Wend
   DeactivateSignal(OUTPUT4)
   Sleep(250)
   DoSpinCW()
Else
    DoSpinCW()
End if

But why is there a difference between "If GetOEMLed(77) Then" and "If IsActive(OUTPUT4) Then"?

Regards Morten