NOTICE:  LPCWare.com is moving to nxp.com.  The LPCware.com Forums are now read-only. Forum content has been migrated to community.nxp.com. LPCware.com user accounts could not be migrated due to security restrictions.  We encourage you to create a user account on nxp.com to use the new community forums and access NXP microcontroller content. We greatly appreciate your contributions to the LPC community and look forward to seeing you at our new web location.

 

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: 2637

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: 2637

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