Handling “Port4 to Port7” GPIO Interrupt in PSoC 4 Series – KBA231049

Version 2

    Author: LinglingG_46         Version: **

     

    Translation - Japanese:  PSoC 4シリーズでの「Port4 から Port7」のGPIO割り込みの処理 – KBA231049 - Community Translated (JA)

    Question:
    How do I handle the “Port4 to Port7” GPIO interrupt?

    Answer: 
    In PSoC® 4 series, GPIO dedicated interrupt only supports Port 0, Port1, Port2, and Port3, as listed in Table 1.

     

    Table 1. List of PSoC 4 Interrupt Sources

    Interrupt

    Arm® Cortex®-M0+ Exception No.

    Interrupt Source

    NMI

    2

    SYSCALL_REQ

    IRQ0

    16

    GPIO Interrupt – Port 0

    IRQ1

    17

    GPIO Interrupt – Port 1

    IRQ2

    18

    GPIO Interrupt – Port 2

    IRQ3

    19

    GPIO Interrupt – Port 3

    IRQ4

    20

    GPIO Interrupt – All Port

     

     

    If you want to use GPIO interrupt in Port4 to Port7, it needs to handle the interrupt source “GPIO Interrupt - All Port”.

     

    Here are the design and implementation steps to handle GPIO Interrupt - All Port:

    1. Drag a Global Signal component, choose Combined port interrupt (AllPortInt).
    2. Drag a digital input pin, assign to any pin in Port4 to Port7.
    3. Enable the input interrupt. Choose one of the three modes: falling edge, rising edge, or both edges, as required.
    4. In the main function, start the Global Signal component isr.
    5. Define an interrupt handler to process the interrupt.

    Here is the code snippet:

    #include "project.h"

     

     

    static void AllPort_Interrupt_Handle(void)

            {

            

                Pin_isr_ClearInterrupt();

     

            }

     

    int main(void)

    {

        CyGlobalIntEnable; /* Enable global interrupts. */

     

        isr_2_StartEx(AllPort_Interrupt_Handle);

       

        /* Place your initialization/startup code here (e.g. MyInst_Start()) */

     

        for(;;)

        {

            /* Place your application code here. */

        }

    }

     

    /* [] END OF FILE */