DigiKey has a 19.6608mhz crystal. If I did the math right...
math = 19,660,800/4/65536 =75 cycles
Your interrupt will happen 75 times/second. In software count to 75 and then add 1 to the second number.
or
last time I used a 20,000,000 crystal
20,000,000/4/65536=76.29395hz In software dividing by 76 is not good but close.
The interrupt happens 76.29395 times/second.
I used a 16bit variable and on every interrupt added 859 to the number. The variable overflows once per second. I think the math is off by .001%


and they are not too complicated!!!

Bookmarks