[SOLVED] how to program an RTC in LPC2368

Status
Not open for further replies.

bikashh

Full Member level 5
Joined
Nov 28, 2009
Messages
264
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
india
Activity points
3,132
hello friends, i want to program RTC in my LPC2368 board.but don't know how to start please guide.
 

see the working code.......
 

Attachments

  • rtc.doc
    34 KB · Views: 137
i've written a progam for RTC but its not working please check.

main()
{
Init_UART0(9600);
InitTimer();
uart0Puts("Initialize OK \n\r");
RTC_Init();
while(1)
{}
}

__irq void RTC_ISR(void)
{
if(RTC_ILR & 0x01)
{
uart0Puts("Counter incrementing\n\r");
RTC_ILR = 0x01; //clear interrupt
}

VICVectAddr=0x00000000;//dummy write to signal end of enterrupt
}

void RTC_Init(void) //Pclk=12Mhz
{
RTC_CISS = 0x00;
RTC_CIIR = 0x01; //enable seconds counter interrupt
RTC_CCR = 0x01; // Enable clock
RTC_ILR = 0x01; //enable clock interrupt and inactive alarm interrupt
RTC_PREINT = 0x0000016D; //set RTC prescalar for 12Mhz;=(PCLK/32768)-1
RTC_PREFRAC= 0x00001B00; // = PCLK - ((PREINT + 1) x 32768)

VICVectAddr13=(unsigned long)RTC_ISR;
VICVectCntl13=0x0000002D;
VICIntEnable= 0x00002000;
}

thanks for the reply
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…