3 posts in this topic

Hi, i have some MBHP for MIOS8 and i will use like clockbox. But i missing TAP button for setting BPM. Im looking for solution. I have idea, for best measure accuracy between pushes, i will use pin 15 (RC0) with timer capture function. For clockbox is not necessary hardware and its free to use. But, i dont know, and i cant find, is that timer free to use in capture mode for calculating BPM? Im trying study C and ASM code and i cant find anything. I thing, is not used and i can use it, but. Please give me some advice first, if you have idea how to solve it clearly, or im on a good way to do it. Mabe is not necessary to use something like external interruption in pin 15. I will use standart DIN pin with 74HC595 just for start and stop measure of BPM. 

Share this post

Link to post
Share on other sites

Hi Vodrha!

I just react cause I'm a real fan of the clockbox, but unfortunately I can't help you.

I've build a clockbox myself: THIS ONE  It works great but I wanted it to slave to another midiclock,. As you can read in THIS POST I tried to modify the code to get the slave function. I spent hours/days with it, but I'm no programmer at all and I got stuck. As you can read in my posts I tried to copy codes from an earlier version, with slave functionallity, into the new code, buit I didn't really know what I was doing....In the end I came quite far, I got it slaving, but with output BPM's 4 times as fast. But with the divisions I can get the right BPM's slaving. So working, but with some nasty workaround.....

I hope you manage to fulfill your needs, and.... maybe you can get it slaving the right way :)..Wich version are you using?

Goodluck and cheers!


Share this post

Link to post
Share on other sites


@vodrha You're right you can use an input pin as timer capture input, depending on timer frequency you will get a a good accuracy but this not the easiest way...

Why not using SR_Service_Prepare(void) which is called every millisecond, check your input pin value, reset and start counting on first falling edge, stop and store counter value on second falling edge, you will get the duration per quarter note "D" in ms.
Then calculate your tempo  T= 60000/D
an finaly set your tempo using  MCLOCK_BPMSet(T);

Best regards

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now