Author Topic: RTC configuration for P89LPC922  (Read 4446 times)

Sudhir kunder

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
    • Email
RTC configuration for P89LPC922
« 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.

erikm

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Re: RTC configuration for P89LPC922
« Reply #1 on: June 06, 2007, 05:32:47 am »
Wrong forum

what does this have to do with FlashMagic

try www.8052.com

erik

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2160
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: RTC configuration for P89LPC922
« Reply #2 on: June 06, 2007, 10:11:30 am »
Embedded Systems Academy, Inc.
support at esacademy dot com