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.

如何把串口发送过来的数据存储起来呢?



各位好。我做串口实验收发一切可以。现在我想将串口发过来的数据进行接收起来。(长度以知)。

while(1)
  {
  while (!(IFG2&UCA0RXIFG));                 // USCI_A0 TX buffer ready?
   data=UCA0RXBUF;                     // TX -> RXed character
   rx[i]=data;
   i++;
   if(i==3)
   {i=0;}
   UCA0TXBUF=data;
  }

通过在线仿真,可以看到,rx数组一直没被赋值,但data有数值,我就不清楚这是怎么回事?

我要是想把数据存储到数组里,是要怎么实现呢?