This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC1768 Interrupt on GPIO PORT 2

Hi all,
I'm trying to make an interrupt on one pin of the port 2. I found the registry setting, but I do not know the name of the interrupt function.

For an interrupt EXT1 the name of the function is "void ext1_int (void) __ irq". For an interrupt on port 2, how should I do?
Where I put my routine interruption?

Thank you for your help :)

Parents
  • Hello,
    I have make a test and I think i Have found the solution:

    void init_interrupt_channel(void) {
    
            LPC_GPIO2->FIODIR &= ~(1<<5);                      /* EINT1 as input */
            LPC_GPIOINT->IO2IntEnF |= (1<<5);              /* Enable falling edge irq 2.11 */
            NVIC_EnableIRQ(EINT3_IRQn);             /* enable irq in nvic */
    
    }
    
    /*----------------------------------------------------------------------------
     *   External Interrupt PORT 2 Service Routine:  Digital Channel
     *---------------------------------------------------------------------------*/
    void EINT3_IRQHandler (void) {
    
            LPC_GPIO2->FIOSET   = (1<<8);
            LPC_GPIOINT->IO2IntClr |= (1 << 5);    /* Clear pending interrupt */
    }
    

    this is fair?

Reply
  • Hello,
    I have make a test and I think i Have found the solution:

    void init_interrupt_channel(void) {
    
            LPC_GPIO2->FIODIR &= ~(1<<5);                      /* EINT1 as input */
            LPC_GPIOINT->IO2IntEnF |= (1<<5);              /* Enable falling edge irq 2.11 */
            NVIC_EnableIRQ(EINT3_IRQn);             /* enable irq in nvic */
    
    }
    
    /*----------------------------------------------------------------------------
     *   External Interrupt PORT 2 Service Routine:  Digital Channel
     *---------------------------------------------------------------------------*/
    void EINT3_IRQHandler (void) {
    
            LPC_GPIO2->FIOSET   = (1<<8);
            LPC_GPIOINT->IO2IntClr |= (1 << 5);    /* Clear pending interrupt */
    }
    

    this is fair?

Children
No data