Yahoo Groups archive

Lpc2000

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

Message

Re: RTC problem

2005-07-21 by Owen Mooney

I think this is most of it below.

The RTC is fairly cool. You can set EXTWAKE so that it wakes the 
processor up from power down every second
i.e processing available every second (or other external interrupt)  but 
with 10 uA power consumptions.

Owen Mooney

#define BIT0     0x00000001
#define BIT1     0x00000002
#define BIT2     0x00000004
... etc

// 2138 interupt sources

#define    WDT_NUM  0
#define TIMER0_NUM  4
#define TIMER1_NUM  5
#define  UART0_NUM  6
#define  UART1_NUM  7
#define   PWM0_NUM  8
#define   I2C0_NUM  9
#define   SPI0_NUM 10
#define   SPI1_NUM 11
#define    PLL_NUM 12
#define    RTC_NUM 13
#define  EINT0_NUM 14
#define  EINT1_NUM 15
#define  EINT2_NUM 16
#define  EINT3_NUM 17
#define     AD_NUM 18
#define   I2C1_NUM 19
#define    BOD_NUM 20

// 2138 interupt sources as bit masks

#define    WDT_BIT  BIT0
#define TIMER0_BIT  BIT4
#define TIMER1_BIT  BIT5
#define  UART0_BIT  BIT6
#define  UART1_BIT  BIT7
#define   PWM0_BIT  BIT8
#define   I2C0_BIT  BIT9
#define   SPI0_BIT BIT10
#define   SPI1_BIT BIT11
#define    PLL_BIT BIT12
#define    RTC_BIT BIT13
#define  EINT0_BIT BIT14
#define  EINT1_BIT BIT15
#define  EINT2_BIT BIT16
#define  EINT3_BIT BIT17
#define     AD_BIT BIT18
#define   I2C1_BIT BIT19
#define    BOD_BIT BIT20


  // setup the Interrupt vectors
  // done in a group so as not to double up on any registers or lines
  // in order of priority
  // RTC Timer highest priority
  VICIntSelect &= ~RTC_BIT; 
  VICIntEnable = RTC_BIT;
  VICVectCntl0 = 0x20+RTC_NUM;
  VICVectAddr0 = (unsigned int)RTCISR;



static void RTCISR(void) __attribute__ ((interrupt ("IRQ")));
static void RTCISR(void) {
  int c;
  // clear interrupt
  c=ILR;
  ILR=1;
 ... code
  // Update VIC priorities
  VICVectAddr = 0;
}

static void initRTC(void) {
   CCR=0;         // disable
   CIIR=BIT0;      // 1 sec interrupt
   AMR=0;
   CCR=BIT0+BIT4; // enable + from Xtal
}

Attachments

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.