Flash Magic Forum

In-System Programming Support => LPC9xx/LPC9xxx => Topic started by: Sudhir kunder on June 06, 2007, 12:29:03 AM

Title: RTC configuration for P89LPC922
Post by: Sudhir kunder on June 06, 2007, 12:29:03 AM
Hello sir,

I'm using P89LPC922FN for one of my project. In this I'm using RTC function.
I have used external clock source for RTC. The hardware connection is as
mentioned below
a) 32KHZ crystal at Port pin no 6 & 7
b) 15M resistor across Port pin no 6 & 7
c) 330K resistor across crystal pin and Port pin no 7
d) 22PF capacitor across each crystal pin and ground.

In Program following configuration and routine has been written

Declaration:
//***********************************************************
#define   rtc_low     0xff
#define   rtc_high  0x00//32KHz clk is used as a rtc clk
#define   rtc_con1  0x42//intrpt in 1 seconds
#define   rtc_con2  0x43//low freq clk select & rtc enable
//***********************************************************
Initialization:
//***********************************************************
RTCCON   = rtc_con1;
EWDRT   = 1;
RSTSRC   = 0X00;
RTCL   = rtc_low;
RTCH   = rtc_high;
WDCON   = 0Xe0;
RTCCON   = rtc_con2;
//***********************************************************
Interrupt:
//*********************************************************************
void rtc (void) interrupt 10//RTC interrupt arrives after every one sec
{
RSTSRC   = 0X00;
RTCCON   = rtc_con2;
RTCL   = rtc_low;
RTCH   = rtc_high;
****** Rest is the normal routine as per our process requirement ********

}
//*********************************************************************
Presently when I switch on my unit some times  RTC interrupt doesn't
come in time of one second and in this condition when I touch the 32KHZ crystal, controller starts Please guide me whether  hardware connection and
software configuration as mentioned above is proper. Is there any other method so that this problem can be solved.   

Please send some example program of RTC . Hope you will do the needful.

Thanks & Regards,
For Leela Electronics.
Sudhir Kunder.
Title: Re: RTC configuration for P89LPC922
Post by: erikm on June 06, 2007, 05:32:47 AM
Wrong forum

what does this have to do with FlashMagic

try www.8052.com

Title: Re: RTC configuration for P89LPC922
Post by: Andy Ayre on June 06, 2007, 10:11:30 AM
Also try http://www.codearchitect.org.

Andy