Page 1 of 1

Turning off interrupts in ISR

Posted: Sun Aug 21, 2011 6:00 pm
by stube40
My interrupt service routines generally look like this:

#pragma vector = PORT1_VECTOR
__interrupt void PORT1_ISR(void)
{
__disable_interrupt(); // Disable global INTs so nothing can interrupt this ISR

// General content of ISR

__enable_interrupt(); // Re-enable global INTs
}

I was wondering - is it necessary to manually disable/enable interrupts as I currently do, or does IAR automatically look after this for you when it compiles hence making my calls to __disable_interrupt() and __enable_interrupt() redundant?

Re: Turning off interrupts in ISR

Posted: Mon Aug 22, 2011 7:56 am
by UhClem
stube40 wrote: I was wondering - is it necessary to manually disable/enable interrupts as I currently do, or does IAR automatically look after this for you when it compiles hence making my calls to __disable_interrupt() and __enable_interrupt() redundant?
Read the user guide for the particular MSP430 family you are using. I checked one to verify my memory of interrupt processing:

"The SR is cleared. This terminates any low-power mode. Because the GIE bit is cleared, further
interrupts are disabled."

The hardware does it.

Re: Turning off interrupts in ISR

Posted: Mon Aug 22, 2011 9:34 pm
by stube40
UhClem wrote:
stube40 wrote: I was wondering - is it necessary to manually disable/enable interrupts as I currently do, or does IAR automatically look after this for you when it compiles hence making my calls to __disable_interrupt() and __enable_interrupt() redundant?
Read the user guide for the particular MSP430 family you are using. I checked one to verify my memory of interrupt processing:

"The SR is cleared. This terminates any low-power mode. Because the GIE bit is cleared, further
interrupts are disabled."

The hardware does it.
Many thanks!