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.

Disable all interrupts and enable only certain ones on MSP430



Hi All,

 I have a question on MSP430, is there any way I can disable all interrupts and then only enable 2 that I need? The problem is during some code execution I need to disable all the interrupts and after this code, I need to only enable 2 interrupts, the problem is, I don't know which Interrupts have been enabled before this code execution, so I cannot manually disable only the interrupts that I don't need, and to disable all interrupts one by one, except the ones I need, would mean a lot of extra code and I might miss one of all the interrupts that are in MSP430. The reason I don't know which interrupts have been previously enabled is that apart from my code, any arbitrary user code might be present on the firmware.

 I don't know if I made myself clear, basically, I need something like this

__disable_interrupt();

//Do some code

//enable only 2 interrupts
//__enable_interrupt();

the problem with __enable_interrupt is that it only uses 1 global interrupt bit, which by setting it back would enable all the previously enabled interrupts. Is there any way to do what I need?

  • Hi,

    Which MSP are you using ? Depending on your MSP there might not be too many registers you will need to check to disable interrupts. Mainly you will need to check IE1, IE2, P1IE, P2IE, timer control registers etc.

    Regards,

    Praval

  • Hi Praval,

     Thanks for the reply, actually I am using CC430x613x and it has plenty of interrupts, I was going through the define section and looked for the variables which ended with IE and there are many, what I was actually thinking was remapping the interrupt vector to a "User Flash Memory" segment and then in the actual Interrupt Vector put addresses to intermediary ISR's which would decide if the ISR defined in the User Flash Memory should be called or just return without doing anything, of course this would add some cycles overhead but I think it's ok for my purposes, then I can only change 1 variable before executing my code to indicate that the user's ISRs should not be called at that time, and also after executing my code set a variable which indicates the 2 interrupts which I want should execute my defined ISR.

      Of course this would mean extra work for the user which programs the application, needs to redefine the Interrupt Vectors on his linker file, but for now, this is a good way to accomplish what I am trying to do. There are only

     Do you have any other suggestions, appart from manually disabling all interrupts manually, which I think can lead to errors if not done thoroughly?

    Regards,

      JC

**Attention** This is a public forum