LPC11U GPIO Interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC11U GPIO Interrupt

1,394 次查看
lydiaj5000
Contributor I

I'm trying to get a GPIO edge interrupt to work on Port 0 Pin 20 of an LPC11U24, but I can't figure it out. My code is as follows:

InitInterrupt()

{

   NVIC_DisableIRQ(FLEX_INT0_IRQn);

    LPC_SYSCON->SYSAHBCLKCTRL |= 0x01 << 19;

    LPC_SYSCON->SYSAHBCLKCTRL |= 0x01 << 23;

    LPC_GPIO->DIR[0] &= ~(ANX_INTP);

    LPC_SYSCON->PINTSEL[0] = 20;

    LPC_GPIO_PIN_INT->ISEL &= ~0x01;

    LPC_GPIO_PIN_INT->IENR |= 0x01;

    LPC_GPIO_PIN_INT->SIENR |= 0x01;

    NVIC_EnableIRQ(FLEX_INT0_IRQn);

}

The interrupt:

void FLEX_INT0_IRQHandler(void)
{
    uint32_t intStat = 0;
    intStat = LPC_GPIO_PIN_INT->IST;
    LPC_GPIO_PIN_INT->IST = intStat;
    NVIC_ClearPendingIRQ(FLEX_INT0_IRQn);
}

Can anyone tell me what I am doing wrong?

标签 (1)
0 项奖励
回复
2 回复数

1,240 次查看
svensavic
Contributor III

I dont see where you have set: (it might be different name in your header, but GPIOnIS register...

LPC_GPIO->IS[0] |= (1<<20); //that should enable interrupt sense register for pin 20.

0 项奖励
回复

1,240 次查看
soledad
NXP Employee
NXP Employee

Hi, 

I suggest to use as reference the nxp_lpcxpresso_11u14_periph_pinint LPCOpen example code. 

You can download LPCOpen from the following link: 

LPCOpen Software for LPC11XX | NXP 

Regards 

Soledad

0 项奖励
回复