First of all, use longs because you will need the bit space. Next decide your units that will result in an integer to display. For this example, lets choose ms. Since there are 1000 ms in a second, to get period as whole ms, instead of dividing 1 by x (Hz), divide 1000 by x(Hz) which is the same as (1/x)*1000.
Obviously, if you want units of us then it's 1,000,000/x. You can see why longs are required.
Bookmarks