Hi all,
Quick question about ISRs:
Let's say you have 3 ISRs; is it possibly to "not listen" to any of these ISRs at particular locations in the void loop ()?
Thank you.
Hi all,
Quick question about ISRs:
Let's say you have 3 ISRs; is it possibly to "not listen" to any of these ISRs at particular locations in the void loop ()?
Thank you.
Sure. Just disable the ones you don't to work.
Paul
Interrupts can be individually enabled / disabled. How you do that depends on the board / processor in use -- which you didn't tell us.
My apologies:
Arduino Mega.
If you can get away with not selectively disabling them you can use noInterrupts() and interrupts() calls to temporarily disable the interrupts. You don't want to do this for very long because it disables ALL interrupts (serial, timers, etc.), including ones used by the system and not you.
ArianKS:
Arduino Mega.
Assuming you’re referring to interrupts caused by signals present on the board’s pins (verses internal interrupts from USART, I2C, timers, etc), the applicable interrupt mask registers are found in Section 15.2 of the ATmega2560 datasheet:
For External Interrupts: EIMSK
For Pin Change Interrupts: PCMSK0, PCMSK1, and PCMSK2
If you do not need every last bit of performance, you can also use flags that are set or cleared in the loop() function and that are tested in the ISRs. The flags will have to be declared globally and declared volatile to be properly shared between the ISRs and the loop() function.
Thank you all!
All suggestions make sense. I’ll implement and get back here if I hit any issues.
Thank you again.