lpc1768 external interrupt problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

lpc1768 external interrupt problem

520 Views
lpcware
NXP Employee
NXP Employee
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;
} 
0 Kudos
3 Replies

341 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Nov 02 02:48:04 MST 2011

Quote: mahyar
...but i want  to know whats my problem in this code.



Sorry, your code isn't readable for me and not compilable for my (LPCXpresso) compiler :rolleyes:

Things like PINSEL_CFG_Type or EXTI_Init() are not shown :eek:

Perhaps you should ask somewhere else ('your compiler' forum) or wait for further answers in LPC2000 forum :)
0 Kudos

341 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mahyar on Wed Nov 02 02:21:42 MST 2011

Quote: Zero
There's a working example in RDB1768cmsis2.zip: RDB1768cmsis2_ExtInt :)


thanks man, but i want  to know whats my problem in this code.
0 Kudos

341 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Nov 01 04:54:45 MST 2011
There's a working example in RDB1768cmsis2.zip: RDB1768cmsis2_ExtInt :)
0 Kudos