看了楼上的代码,与我的代码差不多,因为我没有开RTC中断
void RTCInit( void )
{
alarm_on = 0;
/* Enable CLOCK into RTC */
LPC_SC->PCONP |= (1 << 9);
/* If RTC is stopped, clear STOP bit. */
if ( LPC_RTC->RTC_AUX & (0x1<<4) )
{
LPC_RTC->RTC_AUX |= (0x1<<4);
}
/*--- Initialize registers ---*/
LPC_RTC->AMR = 0;
LPC_RTC->CIIR = 0;
LPC_RTC->CCR = 0;
return;
}
void RTCStart( void )
{
/*--- Start RTC counters ---*/
LPC_RTC->CCR |= CCR_CLKEN;
LPC_RTC->ILR = ILR_RTCCIF;
//LPC_SC->PCONP &= (~(1 << 9));
return;
}
开机时,做:
RTCStart();
RTCInit();
好像没什么问题! |