I found this part from the example code for UART for MSP430FR57xx from TI.
I don't understand what __even_in_range(UCA0IV,0x08)
does mean?
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
switch(__even_in_range(UCA0IV,0x08))
{
case 0:break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
break;
case 4:break; // Vector 4 - TXIFG
default: break;
}
}
The interrupt vector register never has a value that is odd, or larger than eight. So if you tell the compiler about this, it is possible to generate slightly more efficient code by leaving out the checks for those values, and by implementing the cases with a simple jump table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With