Pin interrupt on Port 1, pin1

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

Pin interrupt on Port 1, pin1

422 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tyassin on Tue Jun 18 03:15:06 MST 2013
Hello,

I try to generate an interrupt on PIO1_1, but as you can properly guess it is not working.
I have attached my code here:

void GPIO_int(void)
{
    /* Enable AHB clock to the GPIO domain. */
    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);

    /* Enable AHB clock to the FlexInt, GroupedInt domain. */
    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<19) | (1<<24);
    LPC_GPIO_PORT->DIR[1] &= ~(1<<1);    //Port 1, pin 1
    LPC_SYSCON->PINSEL[0] = 1 + 32;        //Interrupt Port 1, pin 1
    LPC_GPIO_PIN_INT->ISEL &= ~(1<<0);    //Edge sensitive
    LPC_GPIO_PIN_INT->IENR |= (1<<0);    /*Enable edge or rising level interrupt */
    //Enable registers
    LPC_GPIO_PIN_INT->SIENR |= (1<<0);    /*Enable Rising edge interrupt */
    LPC_GPIO_PIN_INT->IST = (1<<0);
    NVIC_EnableIRQ(PIN_INT0_IRQn);

}

void PIN_INT0_IRQHandler(void)
{
    LPC_GPIO_PORT->SET[0] = 0x10000;
    if ( LPC_GPIO_PIN_INT->IST & (0x1<<0) )    LPC_GPIO_PIN_INT->IST = 0x1<<0;
}
I have this ISR that should at least set an output pin high, but nothing happens.

If someone could take a look.
Thank you.
0 Kudos
3 Replies

321 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tyassin on Tue Jun 18 04:11:29 MST 2013
Hello again,

I have it working now. There was a misunderstanding in my code which I have fixed:

LPC_SYSCON->PINSEL[0] = xx


Here I had written as if it was a 32-bit register. Instead it is just a 5-bit word indicating the bit position.

My bad.
0 Kudos

321 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tyassin on Tue Jun 18 03:51:56 MST 2013
Yes....LPC11A14
0 Kudos

321 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Jun 18 03:49:05 MST 2013

Quote: tyassin
I try to generate an interrupt on PIO1_1, but as you can properly guess it is not working.



Is there some kind of MCU behind this pin?
0 Kudos