Yahoo Groups archive

Lpc2000

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

Thread

RTC in LPC2106

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;
	}
}

Re: RTC in LPC2106

2005-01-07 by lpc_bavaria

Hi Ezequiel,

have you set the prescaler registers RTC_PREINT and RTC_PREFRAC to
divide down your pclk to 32.768 kHz?

Cheers,
Rolf


--- In lpc2000@yahoogroups.com, "acetoel" <acetoel@y...> wrote:
Show quoted textHide quoted text
> 
> 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;
> 	}
> }

Re: RTC in LPC2106

2005-01-08 by acetoel

Ups... I didn't do that... how can I set it up, if I have a PCLK and
CCLK of 60Mhz?
Thanks
Ezequiel

--- In lpc2000@yahoogroups.com, "lpc_bavaria" <lpc_bavaria@y...> wrote:
Show quoted textHide quoted text
> 
> Hi Ezequiel,
> 
> have you set the prescaler registers RTC_PREINT and RTC_PREFRAC to
> divide down your pclk to 32.768 kHz?
> 
> Cheers,
> Rolf
> 
> 
> --- In lpc2000@yahoogroups.com, "acetoel" <acetoel@y...> wrote:
> > 
> > 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;
> > 	}
> > }

Re: [lpc2000] Re: RTC in LPC2106

2005-01-09 by Rolf Meeser

Hi Ezequiel,

you find the formulas in the User Manual (Chapter 15,
Reference clock divider).

For a 60 MHz PCLK you obtain:

RTC_PREINT = int( 60e6/32768 ) - 1 = 1830
RTC_PREFRAC = 60e6 - ((1830 + 1) * 32768) = 1792

For the widely used 14.7456 MHz crystal, where you can
set CCLK and PCLK to 58.9824 MHz, you obtain
RTC_PREINT=1799, RTC_PREFRAC=0

Cheers,
Rolf


--- acetoel <acetoel@...> wrote:

> 
> Ups... I didn't do that... how can I set it up, if I
> have a PCLK and
> CCLK of 60Mhz?
> Thanks
> Ezequiel
> 
> --- In lpc2000@yahoogroups.com, "lpc_bavaria"
> <lpc_bavaria@y...> wrote:
> > 
> > Hi Ezequiel,
> > 
> > have you set the prescaler registers RTC_PREINT
> and RTC_PREFRAC to
> > divide down your pclk to 32.768 kHz?
> > 
> > Cheers,
> > Rolf
> > 
> > 
> > --- In lpc2000@yahoogroups.com, "acetoel"
> <acetoel@y...> wrote:
> > > 
> > > 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;
> > > 	}
> > > }
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

Re: [lpc2000] Re: RTC in LPC2106

2005-01-11 by Richard

This looks like the code from our Beta compiler's AppBuilder? If so, the 
next release has that fixed...

>--- acetoel <acetoel@...> wrote:
>
> >
> > Ups... I didn't do that... how can I set it up, if I
> > have a PCLK and
> > CCLK of 60Mhz?
> > Thanks
> > Ezequiel
> >
>
>

// richard (This email is for mailing lists. To reach me directly, please 
use richard at imagecraft.com)

Re: RTC in LPC2106

2005-01-11 by acetoel

In fact, I'm testing some of my GCC code with the beta of Imagecraft.
And also using the AppBuilder. This is the first bug I found in ICC
ARM. The AppBuilder doesn't set the RTC Clock.
See you
Ezequiel

--- In lpc2000@yahoogroups.com, Richard <richard-lists@i...> wrote:
> This looks like the code from our Beta compiler's AppBuilder? If so,
the 
> next release has that fixed...
> 
> >--- acetoel <acetoel@y...> wrote:
> >
> > >
> > > Ups... I didn't do that... how can I set it up, if I
> > > have a PCLK and
> > > CCLK of 60Mhz?
> > > Thanks
> > > Ezequiel
> > >
> >
> >
> 
> // richard (This email is for mailing lists. To reach me directly,
please 
> use richard at imagecraft.com)

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.