RTC Code
RTC_Init(LPC_RTC);
/* Disable RTC interrupt */
NVIC_DisableIRQ(RTC_IRQn);
/* preemption = 1, sub-priority = 1 */
NVIC_SetPriority(RTC_IRQn, configRTC_INTERRUPT_PRIORITY);
/* Enable rtc (starts increase the tick counter and second counter register) */
//RTC_ResetClockTickCounter(LPC_RTC);
RTC_Cmd(LPC_RTC, ENABLE);
RTC_CalibCounterCmd(LPC_RTC, DISABLE);
/* Set the CIIR for second counter interrupt*/
RTC_CntIncrIntConfig (LPC_RTC, RTC_TIMETYPE_SECOND, ENABLE);
RTC_AlarmIntConfig(LPC_RTC,RTC_TIMETYPE_SECOND,ENABLE);
RTC_SetAlarmTime (LPC_RTC, RTC_TIMETYPE_SECOND, 2);
/* Enable RTC interrupt */
NVIC_EnableIRQ(RTC_IRQn); |