Interrupts can be enabled for a specific pin(s) on a digital I/O port, correct? How would the ISR determine which pin caused the interrupt?
Because the vector table has only one slot for the Port1 ISR. So the same ISR function gets called no matter which input pin on Port1 needs attention unless I'm wrong...
As other people have suggested in comments this can be MCU dependent, but for ARM(The core behind MSP432) generally the answer is it doesnt know, it looks for it. ARM has a
vectored interrupt system
, which means that every source has its own vector of interrupt, so CPU can easily find out which source is triggering thr interrupt. so far so good.but then it happens that a device can trigger multiple interrupts, like
GPIO
as you said, in this case, CPU knows that which port has triggered interrupt so fires it'sISR
but then it isISR
responsibility to poll device registers to figure out exact interrupt source, there are many of this peripherals with multiple interrupt, timers, DMAs just to name a few.This is exactly why normally peripherals have an interrupt enable bit, that lets them trigger interrupts, but they also have bit masks that controls what exactly can trigger that interrupt internally,
Also have a look at this link for an in action example, specially at their
ISR
that does exactly the same as described above