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.

串口IFG2值什么情况下会变成这样子?



我做无线串口实验时。通过复制TI的代码串口那部分。在进行串口发送时,不能发送。通过仿真能看到IFG2值由0xA0→0xCA→0x08之后再也不变化了,程序因此卡在了判断TX是否空闲的那时候。

赴部分程序:

void init_uart0(void)
{
  P1SEL = BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD
  P1SEL2= BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD
  UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK
  UCA0BR0 = 0x03;                           // 32kHz/9600 = 3.41
  UCA0BR1 = 0x00;                           //
  UCA0MCTL = UCBRS1 + UCBRS0;               // Modulation UCBRSx = 3
  UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
//  IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt
}

void   R_S_Byte(char R_Byte)
{
  while (!(IFG2&UCA0TXIFG));                // USCI_A0 TX buffer ready? 等待TX buffer为空
  UCA0TXBUF =R_Byte;;
}

这是啥情况呢?