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.

[参考译文] CCS/LAUNCHXL-F2.8379万D:向SCI UART发送浮子

Guru**** 2553260 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/630502/ccs-launchxl-f28379d-send-a-float-to-sci-uart

部件号:LAUNCHXL-F2.8379万D

工具/软件:Code Composer Studio

您好,

我需要将浮点数据发送到SCI_UART。 根据SCI示例,发送字符的基本代码为:

char *msg;
//.
msg ="\r\n\nHello World!\0";
scia_msg(msg);
//
////
scia_xmit -从SCI
//
void scia_xmit (int A)
{
while (SciaRegs.SCIFFTX.Bit.TXFFST !=0){}
SciaRegs.SCITXBUF.ALL =A;
}////


scia_msg -通过SCIA
//
void scia_msg(car * msg)传送消息
{
int i;
I = 0;
while (msg[i]!='\0')
{
scia_xmit (msg[i]);
I++;
}
} 

我可以在RX中接收此消息。

但是当我尝试发送这样的字符时:  

float f;
//.....
sprintf (msg,"%f\0",f);
scia_msg (msg); 

此消息将不会发送至RX。

感谢你的帮助。

此致,

Amin

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    Sprintf不打印到SCI/UART。我相信它会尝试发送到控制台,尽管我不太熟悉它。

    要发送浮点,您需要分别发送4个字节的浮点,并进行四次传输。

    SAL
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    谢谢你。

    此致,
    Amin