lpcware

lpc1768 external interrupt problem

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mahyar on Tue Nov 01 03:17:54 MST 2011
hi
i have a problem on using external interrupt in lpc1768 with cmsis library.
this is my code:

void EINT_IRQHandler()
{
      EXTI_ClearEXTIFlag(EXTI_EINT0);
      FIO_SetValue(0,(1<<22));
     
}

int main ()
{
    PINSEL_CFG_Type PinCfg;
    EXTI_InitTypeDef EXTICfg;

    PinCfg.Funcnum = 1;
    PinCfg.OpenDrain = 0;
    PinCfg.Pinmode = 0;
    PinCfg.Pinnum = 10;
    PinCfg.Portnum = 2;
    PINSEL_ConfigPin(&PinCfg);


    EXTI_Init();

    EXTICfg.EXTI_Line = EXTI_EINT0;
    /* edge sensitive */
    EXTICfg.EXTI_Mode = EXTI_MODE_EDGE_SENSITIVE;
    EXTICfg.EXTI_polarity = EXTI_POLARITY_LOW_ACTIVE_OR_FALLING_EDGE;
    EXTI_ClearEXTIFlag(EXTI_EINT0);
    EXTI_Config(&EXTICfg);
    /*
    NVIC_SetPriorityGrouping(4);
    NVIC_SetPriority(EINT0_IRQn, 0);
    */
    NVIC_EnableIRQ(EINT0_IRQn);

    int i=0;
    for(i=0;i<10000000;i++);
    FIO_SetDir(0,(1<<21),1);
    FIO_SetDir(0,(1<<22),1);
    FIO_SetValue(0,(1<<21));

    while(1)
    {
    }

    return 0;
}

Outcomes