100 Hz ...
might have very precise 100 Hz timebase from mains ... just a trafo and two rectifiers !!!
just an idea ...
Alain
100 Hz ...
might have very precise 100 Hz timebase from mains ... just a trafo and two rectifiers !!!
just an idea ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi. Thanks for all the help.
Is the line frequency accurate enough to make a clock??? Hope it is!!!!! Great idea anyway. Thanks.
Manuel
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%
hi ronsimpson!!! thanks for your help. i have two questions:
to calculate the interrupts with TMR1, I thought you had to divide the value by 66535 (0xFFFF). But, as you say, its 66536 because 0x0000 counts, right?
And one last thing. Suppose that a WORD variable is loaded with 60,000
Now we add to that variable, say 1000. Which is going to be the next result??? Is it going to be 0000 because it overflowed, or is it going to be 4535??? (60,000 + 1,000 - 65,535)???
Thanks for your help. Really quick answers you get in this forum!!!!!!!
Manuel
Sorry in my last post, it should have been:
The variable should have been loaded with 65.000!! NOT 60.000
And when we add a thousand, do we get just 0x0000 or 465 (65000 + 1000 - 65535)??? Thanks
Manuel
1st question divide by 0x010000
2nd question = 464
Do you really need 1 second intervals and how exact do you need to be?
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks