cancel
Showing results for 
Search instead for 
Did you mean: 

how to set the speed in rpm in the code

soundarya_h_s
Associate III

I have imported the motor details from motor pilot and workbench, but now the main challenge is to set the speed in the code 

is there any direct api to change the speed in rpm in the code?

used the below api for starting the motor, it ran smoothly. I want to change the speed next how can i do it

MC_StartMotor1();

3 REPLIES 3
GMA
ST Employee

Hello,

You can use:

MC_ProgramSpeedRampMotor1_F(FinalSpeed_in_rpm,  RampDuration_in_ms)
If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA

Hello @GMA 
I have tried this before but when i measured the output by tachometer, i was not getting the same speed that i have set using this api 

MC_ProgramSpeedRampMotor1_F(FinalSpeed_in_rpm,  RampDuration_in_ms)

Check the number of poles and the API 

MC_ProgramSpeedRampMotor1(RequestedSpeed * ((int16_t)SPEED_UNIT)) / (int16_t)U_RPM,RampDuration_in_ms);

The RequestedSpeed is the actual speed you need, you have to include the SPEED_UNIT / U_RPM factor.