Pwm Spindle calibration
Posted: Thu Mar 07, 2019 4:08 pm
Hello,
I cannot figure out how set the parameters in the C program. Now when i turn on the spindle i reach the max speed at S10000 but it should be at max speed at s18000. ( S is applied by this):
#include "KMotionDef.h"
#define MAX_RPM 18000.0f
// drive PWM 0 as spindle
// PWM 0 is Kstep IO #44 JP33
main()
{
int pwm;
float speed = *(float *)&persist.UserData[0]; // value stored is actually a float
pwm = speed/MAX_RPM * 255.0f;
if (pwm > 255) pwm=255; // limit to max pwm value
printf("Spindle Set to %f pwm %d\n",speed, pwm); // print the desired speed
FPGA(IO_PWMS+1) = 1; // enable the PWM
FPGA(IO_PWMS) = pwm; // set the PWM
}
Here is my setup...
Setup:
Kflop connected to Kstep
Connections:
+5Vdc from spindle control power supply to JP33 Pin5 (AnalogVcc) on the meter is 4.70V
JP33 Pin6 (AnalogOut) to spindle control analog input (expect 0-5V) on meter at max speed is 4.33V
Analog GND to CC gnd VDF
Test Program
CProgram:
{
FPGA(KAN_TRIG_REG) = 4;
SetBitDirection(44,1); \\set pwm output
FPGA(IO_PWMS_PRESCALE) = 46; \\ prescale
FPGA(IO_PWMS) = 128; \\wave
FPGA(IO_PWMS+1) = 1;
}
Can you explain me how i have to sets prescale and wave correctly? I alreay reed the example in Help/SchematicsKStep/UsingKStep.htm#analog but i don't understand how set the prescale as the correct value ? what's the math to arrive to 46 and the relation between 8.3V and the (46 prescale) and 1.4 Khz ? and the wave how i have to calculte what is the best?
What am I doing wrong?
The inveter is a Toshiba VF-nc3 the guide if you need is simply google Toshiba_VF-nC3_User_manual_(simplified).pdf becouse the pdf is to big to attach here.
Tnks for your Help!
I cannot figure out how set the parameters in the C program. Now when i turn on the spindle i reach the max speed at S10000 but it should be at max speed at s18000. ( S is applied by this):
#include "KMotionDef.h"
#define MAX_RPM 18000.0f
// drive PWM 0 as spindle
// PWM 0 is Kstep IO #44 JP33
main()
{
int pwm;
float speed = *(float *)&persist.UserData[0]; // value stored is actually a float
pwm = speed/MAX_RPM * 255.0f;
if (pwm > 255) pwm=255; // limit to max pwm value
printf("Spindle Set to %f pwm %d\n",speed, pwm); // print the desired speed
FPGA(IO_PWMS+1) = 1; // enable the PWM
FPGA(IO_PWMS) = pwm; // set the PWM
}
Here is my setup...
Setup:
Kflop connected to Kstep
Connections:
+5Vdc from spindle control power supply to JP33 Pin5 (AnalogVcc) on the meter is 4.70V
JP33 Pin6 (AnalogOut) to spindle control analog input (expect 0-5V) on meter at max speed is 4.33V
Analog GND to CC gnd VDF
Test Program
CProgram:
{
FPGA(KAN_TRIG_REG) = 4;
SetBitDirection(44,1); \\set pwm output
FPGA(IO_PWMS_PRESCALE) = 46; \\ prescale
FPGA(IO_PWMS) = 128; \\wave
FPGA(IO_PWMS+1) = 1;
}
Can you explain me how i have to sets prescale and wave correctly? I alreay reed the example in Help/SchematicsKStep/UsingKStep.htm#analog but i don't understand how set the prescale as the correct value ? what's the math to arrive to 46 and the relation between 8.3V and the (46 prescale) and 1.4 Khz ? and the wave how i have to calculte what is the best?
What am I doing wrong?
The inveter is a Toshiba VF-nc3 the guide if you need is simply google Toshiba_VF-nC3_User_manual_(simplified).pdf becouse the pdf is to big to attach here.
Tnks for your Help!