Sign in

username:

password:



Not a member?

Search lpc2000



Search tips

Subscribe to lpc2000



lpc2000 by Keywords

2106 | ADC | ARM7 | Atmel | Bootloader | CAN | CrossStudio | CrossWorks | DDS | ECos | Ethernet | ETM | FIFO | FLASH | FPGA | GCC | GDB | GNU | GNUARM | GPIO | I2C | IAP | IAR | JTAG | Kickstart | LCD | Linux | LPC | LPC-E2294 | LPC2000 | LPC2100 | LPC2104 | Lpc2106 | Lpc210x | LPC2114 | LPC2119 | LPC2124 | LPC2129 | Lpc2138 | LPC213x | LPC21xx | LPC2210 | LPC2212 | LPC2214 | LPC2292 | LPC2294 | LPC2xxx | LPC3128 | MCB2100 | Olimex | Philips | PWM | Rowley | RTC | RTOS | SPI | SSP | UART | UART0 | UART1 | ULINK | USB | Watchdog | Wiggler


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | LPC2000 | RTC problem of LPC2148 using gcc


Advertise Here

Discussion group dedicated to the Philips LPC2000 family of ARM MCUs

RTC problem of LPC2148 using gcc - raju_nem - Nov 2 7:58:21 2009

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 )


Re: RTC problem of LPC2148 using gcc - raju_nem - Nov 2 13:26:34 2009

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 )

Re: RTC problem of LPC2148 using gcc - raju_nem - Nov 2 13:27:53 2009

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 )