C axis AC servo info

Moderators: TomKerekes, dynomotion

turbothis
Posts: 325
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

C axis AC servo info

Post by turbothis » Wed Mar 20, 2019 5:03 pm

i want to direct drive a 2.5KW AC servo for my lathe spindle and have indexing also
this will have typical A,B,Z encoder input and dual dac output

i have no idea which C program to start with on this. completely beginner

my first question would be about this line in the dualdac program

"DefineCoordSystem(0,-1,2,-1);"
is the last channel in there the C or would it be A?

would it not be more like this?
DefineCoordSystem(0,-1,2,-1,-1,6);

also not sure about the kmotion screen showing A axis with the X and Y
i might have to get some experience with the editor on that

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: C axis AC servo info

Post by TomKerekes » Wed Mar 20, 2019 5:18 pm

Hi turbothis,
i want to direct drive a 2.5KW AC servo for my lathe spindle and have indexing also
this will have typical A,B,Z encoder input and dual dac output

i have no idea which C program to start with on this. completely beginner
I assume you mean you wish to drive the Spindle Axis like an A Axis Servo to certain angles?

Will you need to sometimes use it as a regular free spinning Spindle? If so you might create two C Programs to add and remove it from the Coordinate System and assign those to M Code Actions.
my first question would be about this line in the dualdac program

"DefineCoordSystem(0,-1,2,-1);"
is the last channel in there the C or would it be A?
A
also not sure about the kmotion screen showing A axis with the X and Y
i might have to get some experience with the editor on that
The standard 4 Axis Screen shows XYZA. If you don't want to see the Y Axis you will need to create a custom Screen with the Screen Editor and Hide the Axes you don't want.
Regards,

Tom Kerekes
Dynomotion, Inc.

turbothis
Posts: 325
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: C axis AC servo info

Post by turbothis » Wed Mar 20, 2019 5:24 pm

i do like the idea of 2 separate user buttons to change from turning and indexing the spindle!

i was thinking the lathe axis where in this configuration?

Image



is there a way to have the A axis read in degrees and only up to 360 and roll back over to 0 after 360? or is it set to just run 0-infinity?

turbothis
Posts: 325
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: C axis AC servo info

Post by turbothis » Fri Mar 22, 2019 4:36 pm

morning bump 4 answer.

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: C axis AC servo info

Post by TomKerekes » Fri Mar 22, 2019 6:54 pm

Hi turbothis,

The angular axes operate over +/- infinity.

You can use an MCode to reset the commanded destination to modulo 360 degrees. See the Modulo360.c example.

Code: Select all

#include "KMotionDef.h"

#define CNTS_PER_DEG 1000.0
#define AXISA 4

double modf(double, double*); // returns integer part with more han 32-bit precision

double floor(double x) // truncate down toward -ininity
{
    double y; 
    return (modf(x, &y) < 0 ? y - 1 : y);
}

main()
{
    double dest = chan[AXISA].Dest;
    double cnts = CNTS_PER_DEG * 360.0;
    EnableAxisDest(AXISA, dest - (floor(dest/cnts)) * cnts);
}
Regards,

Tom Kerekes
Dynomotion, Inc.

turbothis
Posts: 325
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: C axis AC servo info

Post by turbothis » Fri Mar 22, 2019 8:37 pm

awesome!
getting ready to start my weekend of tweaking on this

turbothis
Posts: 325
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: C axis AC servo info

Post by turbothis » Mon Apr 08, 2019 6:59 pm

how would i use this program?
add it to my main axis enable program or into the spindle jog?

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: C axis AC servo info

Post by TomKerekes » Mon Apr 08, 2019 8:07 pm

Hi turbothis,
how would i use this program?
add it to my main axis enable program or into the spindle jog?
Configure an MCode to execute this program. Add the MCode into your GCode wherever you wish to reset the Position.
Regards,

Tom Kerekes
Dynomotion, Inc.

turbothis
Posts: 325
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: C axis AC servo info

Post by turbothis » Mon Apr 08, 2019 8:53 pm

i set this as M100 in kmotioncnc
i ran it through and downloaded in kmotion
if i command M100 in the MDIm bar it should read up to 360 and start over right?
it does not now

Code: Select all

#include "KMotionDef.h"

#define CNTS_PER_DEG 32.97907
#define AXISA 4

double modf(double, double*); // returns integer part with more han 32-bit precision

double floor(double x) // truncate down toward -ininity
{
    double y; 
    return (modf(x, &y) < 0 ? y - 1 : y);
}

main()
{
    double dest = chan[AXISA].Dest;
    double cnts = CNTS_PER_DEG * 360.0;
    EnableAxisDest(AXISA, dest - (floor(dest/cnts)) * cnts);
}

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: C axis AC servo info

Post by TomKerekes » Mon Apr 08, 2019 9:58 pm

Hi turbothis,

Actually if your Spindle has an encoder the code will need to be slightly different. See here.

But it isn't clear what you are saying. When executed the program resets the current value to a value between 0 and 360. It does not cause future movements to roll over at 360. For example if the current machine position is 400 then executing M100 should change it to 40.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply