Maker Pro
Maker Pro

Calculation of motor speed

This is the source of the application note from microchip AN1078
/* End speed converted to fit the startup ramp */
#define END_SPEED (END_SPEED_RPM * NOPOLESPAIRS * LOOPTIME_SEC * 65536 / 60.0)*1024
The formula looks like speed = 60 * f / p; One limited question generally why do we multiply with 65536 and then with 1024?
For example if i have total of 360Degrees to convert uint16 that is 65536, then i do for example 180Degrees as 180/360*65536 = 32768. Is my understanding correct? Similarly why to multiply with 1024?
 

Attachments

  • pmsm.txt
    24.7 KB · Views: 4
  • userparms.txt
    14.3 KB · Views: 0

Harald Kapp

Moderator
Moderator
I can't find microchip AN-1987. Do you have a link that works?
The number suspiciously look like there's a 16 bit timer involved (2^16 = 65536 ans possible a prescaler set to 2^10 = 1024. Where these numbers come from should be detailed somewhere in the app note.
 

Harald Kapp

Moderator
Moderator
This ZIP contains a bunch of code files and at least 4 different Applications. Don't let us guess what you are referring to. Please supply more detail.
 
I am sorry, the application is MCLV-2, the source code is the same for all of them, it is only configuration in userparms.h, i have not changed any of the configuration or source code. I am referring to
AN1078 Demo ReadMe MCLV-2 with dsPIC33CK256MP506 Internal Op-Amp Motor Control PIM (MPLAB X) in the docs section. I am not able to attach the zip files. Please let me know if i have missed anything. The code i am referring to in the initial post is from userparms.h file.
 

Attachments

  • an1078.JPG
    an1078.JPG
    53.4 KB · Views: 5

bertus

Moderator
Hello,

The doc files are just a bit to large to post.
I think you mean this doc in that folder:
AN1078 Demo ReadMe MCLV-2 with dsPIC33CK256MP506 Internal Op-Amp Motor Control PIM (MPLAB X).pdf
What page do you have questions?
You could print the page to a PDF and post it.

Bertus
 
I want to understand the equation and the numbers mentioned 65536 and 1024. How was it arrived?
#define END_SPEED (END_SPEED_RPM * NOPOLESPAIRS * LOOPTIME_SEC * 65536 / 60.0)*1024
 
Top