LPC1768 RTC interrupt per minutes issues

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC1768 RTC interrupt per minutes issues

1,234件の閲覧回数
krishna1
Contributor I

Hi team,

i tried to generate an interrupt in LPC1768 RTC interrupt per minutes, but it is not generate the interrupt per minutes, it generates the per second. 

so please check the below code.

int rtc_initialize()

{

__set_PCONP(PCRTC, 1);     

RTC_CCR = ((1 << SBIT_CTRST) | (1 << SBIT_CCALEN));

RTC_CALIBRATION = 0x00;

RTC_CIIR = 0x0002;    // minutes interrupt

RTC_CCR = (1<<SBOIT_CLKEN);   // Enable clock

RTC_ILR |= (1<<RTCALF);     // enable counter interrupt

__set_irqn_priority(RTC_TRQn,22);

}

let me know for any clarification

Thanks

Krishna

ラベル(1)
0 件の賞賛
返信
1 返信

953件の閲覧回数
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Krishna,

I modified the example of the RTC provided in the LPCOpen 2_10 for the LPC1769 to toggle a led each minute with the RTC minutes interrupt and everything worked fine. Here is the main of my project.

/**
 * @brief     RTC interrupt handler
 * @return     Nothing
 */
void RTC_IRQHandler(void)
{
     /* Toggle heart beat LED for each second field change interrupt */
     if (Chip_RTC_GetIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE)) {
          /* Clear pending interrupt */
          Chip_RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);
          Board_LED_Toggle(0);
     }
}

/**
 * @brief     Main entry point
 * @return     Nothing
 */
int main(void)
{
     SystemCoreClockUpdate();
     Board_Init();
     Board_LED_Set(2, false);
     Chip_RTC_Init(LPC_RTC);

     /* Set the RTC to generate an interrupt on each minute */
     Chip_RTC_CntIncrIntConfig(LPC_RTC, RTC_AMR_CIIR_IMMIN, ENABLE);

     /* Clear interrupt pending */
     Chip_RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);

     /* Enable RTC interrupt in NVIC */
     NVIC_EnableIRQ((IRQn_Type) RTC_IRQn);

     /* Enable RTC (starts increase the tick counter and second counter register) */
     Chip_RTC_Enable(LPC_RTC, ENABLE);

     /* Loop forever */
     while (1)
     {
          __WFI();
     }
}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Hope it helps!

Victor.

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信