3 Replies Latest reply on Jun 4, 2017 11:33 PM by vveasel

    Find digital input interrupt source

    vveasel

      Hi,

         

      I have digital input component (SW) configured for 3 inputs (One, Two, Three) sharing the same falling edge interrupt isr_SW. Physically they all connected to P0[0], P0[1], P0[2] - same PSOC 4000 device port.

         

      How can I determine which pin (for example "SW_One") triggered interrupt from within an isr_SW handler?

         

      Alex

        • 1. Re: Find digital input interrupt source
          user_1377889

          You'll need to read the inputs to decide which pins have changed from high to low.

             

          Think about de-bouncing the switches.

             

           

             

          Bob

          • 2. Re: Find digital input interrupt source
            vveasel

            It is one way of doing it, but if input bounces back quickly to high I may get a false reading plus no way to distinguish between simultaneous transitions on multiple inputs...

               

            I was hoping for a readable mechanism that holds a record of interrupt source. AN86439 has an example on page 50 using Interrupt Status Register and I see a declaration in generated API: 

               

            /* Interrupt configuration Registers */

               

            #define SW_INTCFG                 (* (reg32 *) SW__INTCFG)

               

            #define SW_INTSTAT                (* (reg32 *) SW__INTSTAT)

               

            or GPIO_PRTX_INTR as described in TRM.

               

            but not sure if it is functional in entry level PSOC 4000. I wish Cypress provided an accurate "cheat-sheet" per each chip variation describing implementation limitations vs TRM baseline. 

            • 3. Re: Find digital input interrupt source
              vveasel

              Just to confirm that reading and masking INSTAT (aka GPIO_PRTx_INTR) works perfectly on PSOC 4000