Hi,
Can interrupt every 5 seconds using RTC interrupt instead of 1 second interrupt?
Thank you...!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
Can interrupt every 5 seconds using RTC interrupt instead of 1 second interrupt?
Thank you...!
Hi Anburaja,
Due to the divisions being binary (2,4, 8 etc.) I do not think you'll be able to get 5s exactly. You can set an interrupt on the 1s interval and increment a counter and then do your process on the 5th count. The example code on the RTC Counter mode may assist here.
Another option would be to use a Timer and set the clock source for the timer to be ACLK (32.768 kHz clock) and divide this clock using the ID and/or IDEX registers to divide this clock value down. You can then set the capture compare register (CCRx) to the value that would equal 5s.
Here's some example math:
Equation: CCR value = Timer Period * Timer Clock Frequency - 1.
If we divide ACLK by 4, we get Timer CLK Frequency = 8192 Hz, TimerPeriod = 5s. So the CCR value would be set to (8192 * 5) - 1 = 0x9FFF (hex) or 40959 (decimal).
Here is the Timer example code to assist.
Regards,
Luke
**Attention** This is a public forum