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.

msp430afe253 IAR 中断

Other Parts Discussed in Thread: MSP430AFE253

#include "msp430.h"

void main(void)
{
volatile unsigned int i;

WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1SEL |= BIT3+BIT4; // P1.3,1.4 = USART0 TXD/RXD
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (i = 0x47FF; i > 0; i--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still set?

ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD
U0CTL |= CHAR; // 8-bit character
U0TCTL |= SSEL1; // UCLK= SMCLK
U0BR0 = 80; // 1MHz 115200
U0BR1 = 0x00; // 1MHz 115200
U0MCTL = 0x00; // 1MHz 115200 modulation
U0CTL &= ~SWRST; // Initialize USART state machine
IE1 |= URXIE0; // Enable USART0 RX interrupt
P1SEL2 |= BIT0; // Set SMCLK at P1.0

__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
}

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USART0RX_VECTOR
__interrupt void USART0_RX (void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USART0RX_VECTOR))) USART0_RX (void)
#else
#error Compiler not supported!
#endif
{
while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready?
TXBUF0 = RXBUF0; // RXBUF0 to TXBUF0
}

按照官网给的例程  串口发送可以   无法进入串口接收中断    其他中断也不行 io口外部中断也进不去  不知道是IAR配置问题,还是其他原因