This is the code for RTC,i am trying to printing the HOURS,minutes and seconds by reading
the HOUR,MIN and SEC time counters of RTC.I am getting zero even i am setting the time by
writing the values in to those time counter.what may be the reason? i tried.
#include "LPC2148.h"
#include "stdio.h"
#include "pll.h"
#define MASKSEC 0x3f
#define MASKMIN 0x3f00
#define MASKHR 0x1f0000
#define DESIRED_BAUDRATE 19200
#define CRYSTAL_FREQUENCY_IN_HZ 12000000
#define PCLK CRYSTAL_FREQUENCY_IN_HZ*5 // since VPBDIV=0x01
#define DIVISOR (PCLK/(16*DESIRED_BAUDRATE))
void Initialize_RTC()
{
PCONP |= 0x200;
CCR=0x2; /* Reset the clock */
ILR=0x3; /* Clear the Interrupt Location Register */
CIIR=0x01;
HOUR=0x0;
SEC=0x0;
MIN=0x0;
PREINT = 0x0726;
PREFRAC = 0x0700;
}
int main()
{
PINSEL0=0x00000005;
PLL_init();
InitUart0(); /* Initialize Serial port */
MAMCR = 0x00000000;
MAMTIM = 0x00000003;
MAMCR = 0x00000002;
Initialize_RTC(); /* Initialize System */
HOUR = 23; // Hours
MIN = 14; // Minutes
SEC = 30; // Seconds
CCR=0x01; /* Start RTC */
while(1)
{
printf("\nTime is %02d:%02x:%02d",HOUR,MIN,SEC);
}
}
Help,thanks in advance
------------------------------------

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )
Yes,finally i got the output what i expected by understood the problem in the below
code.
--- In l...@yahoogroups.com, "raju_nem"
wrote:
>
> This is the code for RTC,i am trying to printing the HOURS,minutes and seconds by
reading the HOUR,MIN and SEC time counters of RTC.I am getting zero even i am setting the
time by writing the values in to those time counter.what may be the reason? i tried.
>
> #include "LPC2148.h"
> #include "stdio.h"
> #include "pll.h"
>
> #define MASKSEC 0x3f
> #define MASKMIN 0x3f00
> #define MASKHR 0x1f0000
>
> #define DESIRED_BAUDRATE 19200
>
> #define CRYSTAL_FREQUENCY_IN_HZ 12000000
> #define PCLK CRYSTAL_FREQUENCY_IN_HZ*5 // since VPBDIV=0x01
> #define DIVISOR (PCLK/(16*DESIRED_BAUDRATE))
>
> void Initialize_RTC()
> {
>
> PCONP |= 0x200;
>
> CCR=0x2; /* Reset the clock */
>
> ILR=0x3; /* Clear the Interrupt Location Register */
> CIIR=0x01;
> HOUR=0x0;
> SEC=0x0;
> MIN=0x0;
>
> PREINT = 0x0726;
>
> PREFRAC = 0x0700;
>
> }
> int main()
> {
> PINSEL0=0x00000005;
> PLL_init();
>
> InitUart0(); /* Initialize Serial port */
>
> MAMCR = 0x00000000;
> MAMTIM = 0x00000003;
> MAMCR = 0x00000002;
>
> Initialize_RTC(); /* Initialize System */
> HOUR = 23; // Hours
> MIN = 14; // Minutes
> SEC = 30; // Seconds
>
> CCR=0x01; /* Start RTC */
>
> while(1)
> {
>
> printf("\nTime is %02d:%02x:%02d",HOUR,MIN,SEC);
> }
> }
>
> Help,thanks in advance
>
------------------------------------

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )Thanks to all the people who gave the information and to this group.
--- In l...@yahoogroups.com, "raju_nem"
wrote:
>
> This is the code for RTC,i am trying to printing the HOURS,minutes and seconds by
reading the HOUR,MIN and SEC time counters of RTC.I am getting zero even i am setting the
time by writing the values in to those time counter.what may be the reason? i tried.
>
> #include "LPC2148.h"
> #include "stdio.h"
> #include "pll.h"
>
> #define MASKSEC 0x3f
> #define MASKMIN 0x3f00
> #define MASKHR 0x1f0000
>
> #define DESIRED_BAUDRATE 19200
>
> #define CRYSTAL_FREQUENCY_IN_HZ 12000000
> #define PCLK CRYSTAL_FREQUENCY_IN_HZ*5 // since VPBDIV=0x01
> #define DIVISOR (PCLK/(16*DESIRED_BAUDRATE))
>
> void Initialize_RTC()
> {
>
> PCONP |= 0x200;
>
> CCR=0x2; /* Reset the clock */
>
> ILR=0x3; /* Clear the Interrupt Location Register */
> CIIR=0x01;
> HOUR=0x0;
> SEC=0x0;
> MIN=0x0;
>
> PREINT = 0x0726;
>
> PREFRAC = 0x0700;
>
> }
> int main()
> {
> PINSEL0=0x00000005;
> PLL_init();
>
> InitUart0(); /* Initialize Serial port */
>
> MAMCR = 0x00000000;
> MAMTIM = 0x00000003;
> MAMCR = 0x00000002;
>
> Initialize_RTC(); /* Initialize System */
> HOUR = 23; // Hours
> MIN = 14; // Minutes
> SEC = 30; // Seconds
>
> CCR=0x01; /* Start RTC */
>
> while(1)
> {
>
> printf("\nTime is %02d:%02x:%02d",HOUR,MIN,SEC);
> }
> }
>
> Help,thanks in advance
>
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )