2006-04-03 05:49 AM
2006-04-03 04:35 AM
Hi Users,
I use RTC timebase timer interrupt for many events and i have 2 problems. I set MCCSR=0x02; so I should have interrupt every 2ms by 8MHz clock, but i have every 4ms ( in option HS:8-16MHz range and resonator type - real I have 8MHz resonator) Next problem is that sometimes I have interrupt one after one - looks like not interrupt flag cleaning, but on the beginning of interrupt routine I clear MCCSR&=0xFE flag OIF. I use Cosmic C compiler. Thanks for any help Andrew2006-04-03 05:49 AM
Concerning frequency, look into chapter 10 - Fosc2 means half of the Focs, e.g. crystal frequency.
try to go to disassembly to see, what is listing of your C code. To clear OIF, it should be enough to write MCCSR; // clear OIF flag in your C code. Flag is cleared by read access to MCCSR and Cosmis will handle it properly. Setler