This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

having problem using fiq

Hello,

I'm using MCB2300 with LPC2368 chip. i am using this micro-controller for the first time, so m facing some difficulties. I'm trying to implement the following code by using fiq timer0 interrupt. please guide me, the code gives no error but the interrupt function is not called at run time.

#include <LPC23xx.H>
#include <stdio.h>

static int i=0;
/* Function that initializes LEDs                                             */
void LED_Init(void)
{
  PINSEL10 = 0;                         /* Disable ETM interface, enable LEDs */
  FIO2DIR  = 0x000000FF;                /* P2.0..7 defined as Outputs         */
  FIO2MASK = 0x00000000;
}

/* Function that turns on requested LED                                       */
void LED_On (unsigned int num)
{
  FIO2SET = (1 << num);
}

/* Function that turns off requested LED                                      */
void LED_Off (unsigned int num)
{
  FIO2CLR = (1 << num);
}


__irq void FIQ_Handler (void)
{
                FIO2CLR = 0xFF;
          if(i==0)
          {
                LED_On(6);      /* Turn on LED at P2.6                           */
                LED_On(4);      /* Turn on LED at P2.4           */
                LED_On(2);      /* Turn on LED at P2.2                           */
                LED_On(0);      /* Turn on LED at P2.0                           */
                i++;
          }
          else
          {
                LED_On(7);      /* Turn on LED at P2.7                           */
                LED_On(5);      /* Turn on LED at P2.5                           */
                LED_On(3);      /* Turn on LED at P2.3                           */
                LED_On(1);      /* Turn on LED at P2.1                           */
                i=0;
          }

                T0IR        = 1;                      /* Clear interrupt flag               */
                VICVectAddr = 0;                      /* Acknowledge Interrupt              */
}


void delay1sec(void)
{

        T0PR=0x00;                       // setting prescaler to zero
        T0MR0=0xB749EC;                 // delay in msec * (fcclk/(4*(1000-1))) , fcclk=48MHz
        T0MCR=0x03;             // reset timer and generate interrupt when TC matches MR0
        VICIntSelect  = (1  <<  4);
        VICVectAddr4  = (unsigned long)FIQ_Handler;     /* Set Interrupt Vector        */
        VICVectCntl4  = 15;                             /* use it for Timer0 Interrupt */
        VICIntEnable  = (1  << 4);                        /* Enable Timer0 Interrupt     */
        T0TCR=0x01;                                                                             //enable timer
}



void main(void)
{
        LED_Init();
        delay1sec();
while(1)
        { }

}

0