Hello Guest it is April 19, 2024, 02:03:36 PM

Author Topic: Unlimited Axis Rotation  (Read 5111 times)

0 Members and 1 Guest are viewing this topic.

Unlimited Axis Rotation
« on: December 28, 2012, 04:53:49 AM »
Hi everyone,

I'm writing a mach3 plugin for wood turning!
Can anyone help me how I can rotate A axis at on direction with high speed ?? like sending pulse to servo motor directly!

thanks in advanced

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Unlimited Axis Rotation
« Reply #1 on: December 28, 2012, 07:49:24 AM »
//sure,
//Here is a few vars that you may need.

int m_FeedSpeed = 0;                //these can come from your dialog screen, or pull out of UserDRO's on your Mach screen,
double m_RotationDistance = 0;      //or pull out of UserDRO's on your Mach screen,
int m_Direction = 0;                //(1 is CW, -1 is CCW),
                                    //I will assume your're screen. (I will list them with the member var, in case from dialog)
BOOL RotateAaxis = FALSE;         //have something turn this on, and the conditional will turn it off.      
CString AxisCode = "";
CString AxisDirection = "";

m_FeedSpeed = GetDRO( 2000 );         //from your Axis setup screen or area if setting your vars from your screen.
m_RotationDistance = GetDRO( 2001 );  //from your Axis setup screen or area.
m_Direction = GetDRO( 2002 );         //from your Axis setup screen or area.

if( m_Direction == 1 ) AxisDirection = "";
if( m_Direction == -1 ) AxisDirection = "-";

if( RotateAaxis ) //if your running this from a physical input, you will need to add run once/btn push interlocks.
{
   if( m_FeedSpeed == 0 || m_RotationDistance == 0 || m_Direction == 0 )
   {
      m_RotateAaxis = FALSE;
      return;
   }
   else
   {
      AxisCode.Format("G01 A %s%i F%i", AxisDirection, m_RotationDistance, m_FeedSpeed);
      Code(AxisCode);
      m_RotateAaxis = FALSE;
   }
  
//show us what your doing on your machine when you get this working!
//Scott







fun times

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Unlimited Axis Rotation
« Reply #2 on: December 28, 2012, 04:13:54 PM »
HIYA SCOTT, How does this work ?  Certainly not a wizard in C but I can follow your code. Do you not have to set a Distance value and IF you run out of time does it shut off A.

Will this allow A to run independantly from the  actual Gcode running ?

Just curious, (;-) TP

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Unlimited Axis Rotation
« Reply #3 on: December 28, 2012, 09:03:16 PM »
HIYA SCOTT, How does this work ?  Certainly not a wizard in C but I can follow your code. Do you not have to set a Distance value and IF you run out of time does it shut off A.

Will this allow A to run independantly from the  actual Gcode running ?

Just curious, (;-) TP

see m_RotationDistance above, it will run the code just like you typed it into the MDI line, but if G-code is already running, it will not run, (just like if you type in the MDI line while Gcode is running.)

Having said the above, if your wanting to "Run" an A axis like a spindle, I would use swapaxis().
OR, run a cost effective modbus device like Peters ModIO, or Arturos M12 (or M13), that you could drive an analog controlled VFD to drive the A if your just wanted it to turn until you turn off the analog.....

Or....if using the above, modbus in M3, and you have a VFD to drive the A, then I put a Multi-spindle plugin that you could run, to control it.

scott
fun times

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Unlimited Axis Rotation
« Reply #4 on: December 28, 2012, 11:05:20 PM »
OK that makes sense. I thought you had discovered a way in mach3 to drive an independent rotary axis .

Thanks, (;-) TP
« Last Edit: December 28, 2012, 11:08:03 PM by BR549 »
Re: Unlimited Axis Rotation
« Reply #5 on: December 29, 2012, 05:14:22 AM »
dear scott

thanks for your helps !
can u please tell me more about swapaxis function ?
and how I can turn A axis like spindle while running g-code ?

thanks

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Unlimited Axis Rotation
« Reply #6 on: December 29, 2012, 06:01:52 PM »
OR, run a cost effective modbus device like Peters ModIO, or Arturos M12 (or M13), that you could drive an analog controlled VFD to drive the A if your just wanted it to turn until you turn off the analog.....

Or....if using the above, modbus in M3, and you have a VFD to drive the A, then I put a Multi-spindle plugin that you could run, to control it.

BTW: you can drive an axis outside of M3, with a PLC/motion or VFD

scott
fun times