Hi There
I would like to set multiple (two) CIIR flags in the realtime clock of an LPC1768 as follows
<span class="Apple-tab-span" style="white-space: pre;"> </span>/* Set the CIIR for second counter interrupt*/
<span class="Apple-tab-span" style="white-space: pre;"> </span>RTC_CntIncrIntConfig (LPC_RTC, RTC_TIMETYPE_SECOND, ENABLE);
<span class="Apple-tab-span" style="white-space: pre;"> </span>/* Set the CIIR for day of week rollover interrupt*/
<span class="Apple-tab-span" style="white-space: pre;"> </span>RTC_CntIncrIntConfig (LPC_RTC, RTC_TIMETYPE_DAYOFWEEK, ENABLE);
This is fine, but the manual says that If CIIR is enabled for a particular counter, then every time the counter is incremented an interrupt is generated.
RTCCIF When one, the Counter Increment Interrupt block generated an interrupt. Writing a one to this bit location clears the counter increment interrupt.
27.6.2.3 Counter Increment Interrupt Register (CIIR - 0x4002 400C) The Counter Increment Interrupt Register (CIIR) gives the ability to generate an interrupt every time a counter is incremented. This interrupt remains valid until cleared by writing a 1 to bit 0 of the Interrupt Location Register
Question, which bit set the interrupt? it doesn't actually tell you which CIIR bit fired the increment interrupt
I would like to do something along the lines of the following.
void RTC_IRQHandler(void){
<span class="Apple-tab-span" style="white-space: pre;"> </span>/* This is increment counter interrupt*/
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (RTC_GetIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE))<span class="Apple-tab-span" style="white-space: pre;"> </span>{
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(LPC_RTC->CIIR & RTC_CIIR_IMSEC){
<span class="Apple-tab-span" style="white-space: pre;"> </span>uptime++;
<span class="Apple-tab-span" style="white-space: pre;"> </span>ntp_time++;
<span class="Apple-tab-span" style="white-space: pre;"> </span>}
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(LPC_RTC->CIIR & RTC_CIIR_IMDOW){
<span class="Apple-tab-span" style="white-space: pre;"> </span>;
<span class="Apple-tab-span" style="white-space: pre;"> </span>}
<span class="Apple-tab-span" style="white-space: pre;"> </span>// Clear pending interrupt
<span class="Apple-tab-span" style="white-space: pre;"> </span>RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);
<span class="Apple-tab-span" style="white-space: pre;"> </span>}
Any thoughts appreciated
Regards
Marshall