Turning off interrupts in ISR

Discussions on how to get your MSP JTAG programmer up and running.

Moderator: phalanx

Post Reply
stube40
Posts: 9
Joined: Tue Aug 16, 2011 10:33 pm

Turning off interrupts in ISR

Post by stube40 » Sun Aug 21, 2011 6:00 pm

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?

UhClem
Posts: 408
Joined: Sun Aug 03, 2008 6:11 pm

Re: Turning off interrupts in ISR

Post by UhClem » Mon Aug 22, 2011 7:56 am

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.

stube40
Posts: 9
Joined: Tue Aug 16, 2011 10:33 pm

Re: Turning off interrupts in ISR

Post by stube40 » Mon Aug 22, 2011 9:34 pm

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!

Post Reply