I use 5 step motors to drive the gantry. I use another step or a DC servo motor to drive the extruder. I also use a AC motor driven by a frequency converter to be the spindle motor. I will connect the frequency converter with the Kstep board, refer to the figure below:
My question is: I know in the gcode the code "S**" is to set the spindle speed. But how can the program interpreter knows which port is to control the spindle motor? Because now the AC motor is controlled by the KFLOP IO 44 JP7 Pin5 now, not by the channel 0-3 or 5-7. So it can't be defined by the function named "DefineCoordSystem()" or "DefineCoordSystem8()". So how can the gcode to run the AC motor by a axis name such as A,B,C,U,V?
The nature of my question is: how can we define the axis name of a motor that is not driven by the channel 0-7. For example if the used extruder motor, spindle motor or other motor is not a step motor, but a DC servo motor or AC motor, it can not be connected to the channel 0-7. Then how can we define this DC/AC motor as the A,B,C or U, V axis to make the gcode program can use them?
This maybe a simple question but I am only a beginner come from automation/computer science area. So, sorry...
Yours,
Huang Lei
08-19-2020
I will try to run the example program named "KStepPWMCorrected.c" to test it. And I think it should be ok.How can I define the axis name of a AC spindle motor?
Moderators: TomKerekes, dynomotion
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: How can I define the axis name of a AC spindle motor?
Hi Huang,
The Interpreter "Actions" for M3, M4, M5, and S are normally configured to control the Spindle. The Spindle should not normally be configured as part of the coordinated motion system. KMotionCNC configures the Interpreter Actions as described here.
See the <>\C Programs\KStep\KMotionCNC examples.
The Spindle_S_Kstep.c example can be used to control the KStep PWM->Analog converter. For this example the Interpreter should be configured to pass the desired Speed value in Var 1.
Spindle_S_Kstep.c
The Interpreter "Actions" for M3, M4, M5, and S are normally configured to control the Spindle. The Spindle should not normally be configured as part of the coordinated motion system. KMotionCNC configures the Interpreter Actions as described here.
See the <>\C Programs\KStep\KMotionCNC examples.
The Spindle_S_Kstep.c example can be used to control the KStep PWM->Analog converter. For this example the Interpreter should be configured to pass the desired Speed value in Var 1.
Spindle_S_Kstep.c
Code: Select all
#include "KMotionDef.h"
#include "..\CorrectAnalogFunction.c"
#define RPM_FACTOR 500.0 // RPM for full duty cycle (max analog out)
// desired speed is passed in variable 1
main()
{
float speed = *(float *)&persist.UserData[1]; // value stored is actually a float
FPGA(KAN_TRIG_REG)=4; // Mux PWM0 to JP7 Pin5 IO 44 for KSTEP
SetBitDirection(44,1); // define bit as an output
FPGA(IO_PWMS_PRESCALE) = 46; // divide clock by 46 (1.4 KHz)
FPGA(IO_PWMS+1) = 1; // Enable
FPGA(IO_PWMS) = CorrectAnalog(speed/RPM_FACTOR); // Set PWM
}
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: How can I define the axis name of a AC spindle motor?
I think I understand your mean. I will try. Thank you very much.