PaulS:
Aside from being set to 0 later, and being printed, though I can't see why, later, these are the only two lines that reverence mdpm.
Why they are printed to serial? Simply for this initial debugging purpose, checking that they work as I expect.
RPM will then be output to an LCD screen, whilst dpm will be used in a position code, the ISR will increment an angle pulse counter, so that instantaneous angle becomes angle pulse counter * tooth spacing + (dpm * time since last pulse)
Is it okay then to do 3 * tooth_spacing * 1000000UL, or do I need to specify the other terms as UL?