Jump to content

equation optimization help -BPM calculations

Recommended Posts

(1000 / milliseconds) * 60 = BPM is the equation



is there a way to optimize this equation?

speed is not a factor since i have about 250ms to about 1000ms (250bpm to 60bpm) between beats

when i compile my program it adds A lot of code, about 140bytes, and i would like to get this down, because i still have to add display code and a few other calculations ( average time delay for 4 beats, and cycles to ms)


currently im just looking for some ideas, while i work on some of the other code

Link to post
Share on other sites
Not 100% sure that will generate working code. CCS may not have unsigned / unsigned divide.


i dont know about ccs either since i use mspgcc, but i will try unsigned as well since i dont need signed integers


Edit: unsigned dropped it another 30 bytes or so



you could also try converting your calculations to use fixed point math


Im not using any floating points, like float or double, so it should be all fixed point

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...