Yahoo Groups archive

Lpc2000

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

Message

Problem with entering ISR

2006-05-29 by federr65

I'm just starting with LPC ( I have a LPC-H2138 board from Olicom) and
at the beginning I'm unable to solve the following problem:
I have an Timer0 set to generate interrupts. Timer works just fine,
but I can't force the ISR to execute.
Below is my code:

#include <targets/LPC213x.h>

#define LED 0xF0000000;

static int timer0Count, timer1Count;
int marker=1;


static void PLL_Init(void)
{
  PLLCON=0x00000003; //Kwarc razy 4
  PLLCFG = 0x23;
  PLLFEED = 0xAA;
  PLLFEED = 0x55;
}

void inititate (void)
{
//PLL_Init(); 
//MAMCR = 2; 
IO0PIN=0x0;
IO1PIN=0x0;
IO0DIR = 0xFFFFFFFF;  
IO1DIR = 0xFFFFFFFF;
}



static void timer0ISR(void) __attribute__ ((interrupt ("IRQ")));

static void timer0ISR(void)
{
if (IO0PIN=0) 
  {
  IO0SET=LED;
  }
  else
  {
  IO0CLR=0;
  } 
  /* Clear the timer 0 interrupt */
  T0IR = 0xFF;
  /* Update VIC priorities */
 VICVectAddr = 0;
  marker++;
}

 
int main(void)
{
inititate();
  
 // Timer 0 interrupt is an IRQ interrupt, none is FIQ */
  VICIntSelect =0x0;
  /* Clear all IRQ and Enable timer 0 interrupt */
  VICIntEnClr = 0xFFFFFFFF;
  VICIntEnable = 0x10;
  /* Use slot 0 for timer 0 interrupt and enable it (bit5)*/
  VICVectCntl0 = 0x24;
  /* Set the address of ISR for slot 0 */
  VICVectAddr0 = (unsigned int)timer0ISR;
  /* Match 0 reset - mo¿e nie byæ konieczne do dzia³ania*/
  T0IR = 0x1;
  /* Reset and stop timer 0 */
  T0TCR = 0x2;
  /* Set the timer 0 prescale counter */
  T0PR = 0x0;
  /* Set timer 0 match register */
    /* Set timer 0 match register */
  T0MR0 = 0xffff;
  /* Generate interrupt and reset counter on match */
  T0MCR = 0x3;
  /* Start timer 0 */
 T0TCR = 1;

   /* Enable Interrupts */
// __ARMLIB_enableIRQ();


while(1);
}

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.