Exact BPM clock in Shruthi

How to generate the exact BPM clock in Shruthi. I have tried in 1msec task. But all odd clock div is inaccurate (see my code)

bpm value from 40-240
note div from 1/1, 1/2, 1/3, 1/4, 1/6, 1/8, 1/12, 1/16, 1/24, 1/32, 1/48

My code:

Now… i find a better result :slight_smile:

I have calc the bpm clock in the DAC out task (40KHz interrupt) with higher accuracy…

Hi shruthis :slight_smile:

I do not understand the div settings for bpm. In shruthi the div settings for real 120 bpm is 1/8. Why not 1/1 ???

Greetings from Germany. Rolf

Now… I have testing with metronome:

120 bpm div 1/1 = real 15 bpm
120 bpm div 1/2 = real 30 bpm
120 bpm div 1/3 = real 40 bpm
120 bpm div 1/4 = real 60 bpm
120 bpm div 1/6 = real 90 bpm
120 bpm div 1/8 = real 120 bpm
120 bpm div 1/12 = real 180 bpm
120 bpm div 1/16 = real 240 bpm

and more…