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.

MSP430FR5994: How to completely ignore UART messages after disable ISR(disable GIE) ?

Part Number: MSP430FR5994

I want to completely ignore interrupt event during this period after I turn off GIE and not just mask it.


When I disable the GIE until I turn it on, there will still be UART messages coming in, how can I ignore it completely ?

Because when I enable GIE again, I suddenly get into the ISR to deal with it, and I don't want that.

If I clear the UART receive flag ( UCA0IFG &= ~UCRXIFG ) before I enable GIE, will it have the effect I want?

  • IFGs are set independent of their respective IEs.

    To disable receive interrupts, use something like:

    > UCA0IE &= ~UCRXIE;  // Disable Rx interrupts

    When you want to accept them again:

    > UCA0IFG &= ~UCRXIFG;  // Clear any stale Rx interrupt

    > UCA0IE |= UCRXIE;    // Enable Rx interrupt

  • Thanks I guess that's what I need.

    Can I ask a similar question here?

    Whether the way to completely disable tick isr can take advantage of the following way?

    TA0CTL &= ~MC;   //Disable timer interrupt

    When i want to accept them again:

    TA0CTL |= MC;   //Enable timer interrupt

  • Setting MC=0 stops (freezes) the timer; it doesn't disable timer interrupts. (As a practical matter most timer interrupt Events won't occur while the timer is stopped, but any leftover IFGs can still trigger.)

    The analogue(s) for your UCRXIE usage above are TAIE and CCIE (applying to TAIFG and CCIFG). Here again, best-practice is usually to clear any stale IFG before enabling its IE.

    ----------

    Unsolicited: The name MC ("all the bits in the MC field") is relevant to your first line of code but not your second one. "MC" happens to be the same as "MC_3" or "MC__UPDOWN", which I'm guessing isn't what you had in mind.

**Attention** This is a public forum