can i write two ISR,s for the same port? i need to use both the pushbuttons in P1.0 ans P1.1 to produce different time delay for blinking an LED in the P2.1
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
can i write two ISR,s for the same port? i need to use both the pushbuttons in P1.0 ans P1.1 to produce different time delay for blinking an LED in the P2.1
thank you for your response sir.
but, then, how the second interrupt is executed while the first one is executing?
i need to get the response of second switch at the time of interrupt itself..
NIMIN THOMAS said:but, then, how the second interrupt is executed while the first one is executing?
ISR shall be processing IRQ event and incoming data (if any) as quickly as possible and finish as soon as possible. Things that is not IRQ processing like LED flashing shall be executed outside of ISR code.
Also, as soon as you mention (physical) pushbuttons, you need to be thinking about debouncing (search this forum, or the Web, for discussions of this), which changes your timescale from microseconds to (10s of) milliseconds. Some debouncing procedures don't involve (pin) interrupts at all.
Not at all. You only have once CPU core and it can only execute one instruction simultaneously. To execute the second interrupt, you would have to interrupt the execution of the first one. For several reasons not recommended.NIMIN THOMAS said:but, then, how the second interrupt is executed while the first one is executing?
Fastest way is to loop through all pending port interrupts inside the ISR before exiting. Like this:
while(1){ switch (__even_in_range(P1IV, 16)){ case 0: return; case 2: [...] // P1.0 interrupt break; [...] } }
It saves you the interrupt latency and return time as well as the framing time (saving of registers etc.)
The P1IV/P2IV register is only available for 5x/6x family. A replacement for odler MSP families could be done like this:
while (P1IFG) { if(P1IFG&BIT0){ [handle P1.0 interrupt] P1IFT &= ~ BIT0; } if(P1IFG&BIT1) { [...] }
**Attention** This is a public forum