Hi All,
Im having a bit of trouble with these interrupts on TimerB2 on the MSP430FR5739.
I am using 3 compare registers, TB2CCR0 = 250, TB2CCR1 = 150 & TB2CCR2 = 50
CCR0 Interrupts are easy enough, but im confused when it comes to the rest.
The Family guide says:
The TBIFG flag and TBxCCRn CCIFG flags (excluding TBxCCR0 CCIFG) are prioritized and combined to
source a single interrupt vector. The interrupt vector register TBxIV is used to determine which flag
requested an interrupt.
[Snip]
Any access, read or write, of the TBxIV register automatically resets the highest-pending interrupt flag. If
another interrupt flag is set, another interrupt is immediately generated after servicing the initial interrupt.
For example, if the TBxCCR1 and TBxCCR2 CCIFG flags are set when the interrupt service routine
accesses the TBxIV register, TBxCCR1 CCIFG is reset automatically.
I was hoping to use the following code, using TB2IV to detemrine which CCRn caused the interrupt but if I read this correctly it will be cleared before I get a chance?
Can someone help? Am I misreading or is there a trick around this?
//=====Interrupt for 40Hz timer pre-sample=====
#pragma vector=TIMER2_B1_VECTOR
__interrupt void Interrupt_40_pre(void)
{
switch (TB2IV)
{
case 0x02: //Temp
break;
case 0x04: //Baro
break;
default:
break;
}
}