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.

CCS/MSP430FR5849: MSP430FR5849

Part Number: MSP430FR5849

Tool/software: Code Composer Studio

Hi,

I am designing with the MSP430FR5849DA.

To capture the output from an IR receiver I use pin 36, the TA0 CCR0 capture: CCI0B input.

Table 6-4 (page 58) of the MSP430FR5849 datasheet indicates to use Interrupt vector 0FFEAh to capture an interrupt on this pin.

The MSP430FR5849 family users guide and the CCS MSP430FR5849 header file indicates that the TA0IV register only supports vectors for TA0CCR1 and TA0CCR2.

What is correct and can I use pin 36 under interrupt to capture events?

  • Hi Jan!

    CCR0 always has it's own interrupt vector, whereas CCR1, CCR2, ... share a single vector and TAxIV can be used to determine the interrupt source (this also clears the highest pending interrupt flag). But this does not apply to CCR0 from the other vector, that is why TAxIV does not cover CCR0.

    The interrupt vector for CCR0 from TA0 is:

    #pragma vector = TIMER0_A0_VECTOR
    __interrupt void timer0_a0_isr( void )
    {
      // Interrupt flag for CCR0 cleared automatically when entering the interrupt function
    }

    Dennis

  • Dennis,
    Thanks for the clearification.
    I suspected this but wasn't sure as this is not mentioned in the family users guide.
  • Dennis,

    One more question.
    SInce switch statements are used in interrupt vector handling I also used that initially in my capture compare ISR and made extensive use of the break statement inside the code to jump to the end of the ISR. (I can send you the code if your interested)
    With no switch statement needed anymore the break statement is not the most easy way to jump out of the ISR.
    Could I also use the "exit(0)" statement in stead of the break , without compromising ISR content restore?
  • Hi Jan!

    I do not completely understand what you have written, sorry. And I don't know about "exit(0)". Maybe just post yout ISR code or an example that shows what you are meaning. There is no need to use a switch-case structure in your ISR, but since TA0IV returns an integer value, using-switch case is simple. If you would use

    if( TA0IV == 2 )
    {
      ...
    }
    else if( TA0IV == 4 )
    {
      ...
    }
    ...

    you would clear the highest pending interrupt flag each time TA0IV is accessed, so an if-else if would not work here. Another benefit for switch-case. If you only have one interrupt source enabled, you can completely work without it, simply clear the flag by yourself if it isn't cleared automatically. For CCR1, CCR2, ... you would have to clear it, for CCR0 it is cleared by entering the ISR.

    Dennis

  • Dennis,
    Sorry to confuse you.
    In version 1 of my RC5 decoder used CCR1 as input so I used the TA0IV decoding with the switch statement to get to the correct CCR1 vector and execute the appropriate code.
    My complete RC5 decoder is contained inside the CCR1 case of that switch statement and uses several breaks to exit the case at several points in the code to jump to the end of the ISR. Now with using CCR0 with a single interrupt assigned to it I do not need that switch statement anymore as you also mention.
    No switch statement means no break statements inside the case so I need another way to jump to the end of the ISR in my code or rewrite the complete function.
    I suppose a break statement in a switch case is somewhat like a "goto" statement that points to the end of the switch statement.
    There is in C also an "exit(0)" statement but literature in vague whether or not that directly jumps out of the ISR without any context save or not.

    That was my actual question -> does an "exit(0)" statement in an ISR still does a context save when exiting.

    The better way is probably to use that "goto" statement to the end of the ISR and allow the context restore at ISR exit or rewrite the complete function.
  • Hi Jan,

    If I'm understanding things correctly, you could use a status variable and set it to a specified value when you want to jump to the end of the ISR. Then use If-else statements to keep portions of code from executing based on the value of the variable.

    Best regards,
    Caleb Overbay

**Attention** This is a public forum