Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

RTC in LPC2106

2005-01-06 by acetoel

Hello, I have set up the RTC and make a simple program to test it. But
it doesn't work! Here is the code... on the PC (connected to the
serial port) I always view the same time 19:8:51
Thanks
Ezequiel

#include "LPC210x.h"
#include "Init.h"	
#include "UART.h"
#include "Delayus.h"

#define  Boton 0x80000000
#define  LED1  0x10000000
#define  LED2  0x20000000
#define  LED3  0x40000000

UInt8  contador;
UInt16 Counter2;
UInt32 Hour,Min,Sec;


int main (void) 
{	
	/*Initialize the system*/
 InitLPC2106();
 InitCom();		//115200 bauds
 IODIR=0x70000000;
 IOCLR=0x70000000;
	
 RTC_CCR=0;
 RTC_CIIR=0x00000000;
 RTC_AMR=0x00000000;
 //real date time setting
 RTC_SEC=0x00000033;
 RTC_MIN=0x00000008;
 RTC_HOUR=0x00000013;
 RTC_DOM=0x00000006;
 RTC_DOW=0x00000004;
 RTC_DOY=0x00000004;
 RTC_MONTH=0x00000001;
 RTC_YEAR=0x000007D5;
 //alarm setting
 RTC_ALSEC=0x00000001;
 RTC_ALMIN=0x00000001;
 RTC_ALHOUR=0x00000001;
 RTC_ALDOM=0x00000001;
 RTC_ALDOW=0x00000001;
 RTC_ALDOY=0x00000001;
 RTC_ALMON=0x00000001;
 RTC_ALYEAR=0x000007D0;
 //start rtc
 RTC_CCR=0x00000001;
	
	contador=0x00;
	IOSET = LED2;
	IOSET = LED3;
	printf ("Ezequiel L. Acetp %c%c",'\n','\r');
	//printf("Ezequiel L. Aceto\n");
	//printf("Sunixs Microsystems\n");
	while(1)
	{
	  IOSET = LED1;
	  delayus(1000); //0.5 Sec delay
	  IOCLR = LED1;
	  delayus(1000);
	  Hour = RTC_HOUR;
	  Min  = RTC_MIN;
	  Sec  = RTC_SEC;
	  printf("%2d : %2d : %2d  ",Hour, Min, Sec,'\n','\r');
	  Hour = 0x00;
	  Min  = 0x00;
	  Sec  = 0x00;
	}
}

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.