Mr RB
Well-Known Member
Mr RB submitted a new article:
Accurate 1-second periods with any xtal - Here are some easy C code examples to generate 1-second (or any period) from any xtal value and any
Read more about this article...
Accurate 1-second periods with any xtal - Here are some easy C code examples to generate 1-second (or any period) from any xtal value and any
Here are some easy C code examples to generate 1-second (or any period) from any xtal value and any interrupt period.
The code is performed in an interrupt, and only needs one variable to generate the desired period.
A simple example is a PIC running at 4MHz xtal, which is 1MHz on Timer0 (set to 1:1 prescale). In this example the interrupt occurs every 256 counts, and a second would be 1 million counts;
Code:// C code for a 1 second period with a 1MHz timer (4MHz xtal); //...
Read more about this article...