簡體   English   中英

使用Msp430fr5969通過Tx發送字符串

[英]Using the Msp430fr5969 to send strings over Tx

我試圖將數據從Msp430fr5969啟動板發送到rn-52-ek,以便它可以將數據通過藍牙傳遞。

#include <msp430.h> 

void uartSend(unsigned char *pucData, unsigned char ucLength)
{
  while(ucLength>0)
  {

    // Wait for TX buffer to be ready for new data
    while(!(UCA1IFG & UCTXIFG));

    // Push data to TX buffer
    UCA1TXBUF = *pucData;

    // Update variables
    ucLength--;
    pucData++;
  }



}
void initUART()
{

     /* Place UCA0 in Reset to be configured */
      UCA0CTL1 = UCSWRST;

      //Set BRCLK = SMCLK
      UCA0CTL1 |= UCSSEL_2;

      //Values found using table for 16Mhz and 115200 baudrate
      UCA0BR0=8;
      UCA0BR1=0;
      UCA0MCTLW = 0xF7 << 8;
      UCA0MCTLW |= 10 << 4;
      UCA0MCTLW |= UCOS16;

      //UCA0 out of reset
      UCA0CTL1 &= ~UCSWRST;
}

int main(void) {
      // disable watchdog timer
      //------------------------
      WDTCTL = WDTPW + WDTHOLD;               // Stop WDT

      initUART();


      unsigned char sendString[] = "Banana";
      unsigned char length=6;
      while(1)
      {


          uartSend(sendString,length);

      }

      return 0;
}

當我運行上面的代碼時,什么都沒有發生,甚至沒有在萬用表上讀取任何內容。 我想念什么?

我知道有一些不好的做法,我只想使其正常工作,稍后將添加基於中斷的發送。

您應該將端口2.5設置為UART的Tx

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM