lpc1768 external interrupt problem

3 replies [Last post]
mahyar
Offline
Joined: 2011-11-01
Posts: 3

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
Your rating: None

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ex-Zero
Offline
Joined: 2011-07-19
Posts: 2645

There's a working example in RDB1768cmsis2.zip: RDB1768cmsis2_ExtInt Smile

mahyar
Offline
Joined: 2011-11-01
Posts: 3

Zero wrote:
There's a working example in RDB1768cmsis2.zip: RDB1768cmsis2_ExtInt Smile

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

Ex-Zero
Offline
Joined: 2011-07-19
Posts: 2645

mahyar wrote:
...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 Shock

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

feedback