Skip to main content
Visitor II
July 5, 2019
Question

External Interrupt in PORTB (Multiple pin)

  • July 5, 2019
  • 2 replies
  • 684 views

I configure the portB 4,5,6,7 as external interrupt pins. the program is working well if any interrupt occurs in portb 4,5,6,7 the execution send to irq. how to find which pin irq is occured in portb

please give the solution to my problem

    This topic has been closed for replies.

    2 replies

    Visitor II
    July 5, 2019

    look for PR bits in EXTI block.

    They are set when the defined edge(s) occur.

    Clear the PR bits after reading them.

    Visitor II
    July 7, 2019

    What I do, is store a variable with the current status of the pins. In the interrupt I just read the current port values and compare it with the known status to see what pin has toggled.

    You need to pay attention on how your system is setup. It also depends how the sensitivity bits are configured for the 4 pins.