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.

[参考译文] TMS570LC4357:TMS570LC4357串行通信问题

Guru**** 2422790 points


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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1103887/tms570lc4357-tms570lc4357-serial-communication-problem

部件号:TMS570LC4357

您好,

我想用CCS向串行端口发送十六进制数据,但我无法实现。 我不能发送十六进制数据,尽管我可以 为  字符串发送十六进制数据。  

基本上, 我使用以下代码:

UINT8* text1[1]={0x05};

#define UART sciREG1

int main (void){

 SciInit();

 同时(1){

    sciSendByte(UART,&text1[0]);

}

我在终端上看到了"p"。 欢迎作出任何答复。

此致。

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

    您好,

    您需要先根据ASCII表将字符串转换为整数:


    void UART_send32位数据(scibase_t *sci,UINT32_t数据)

       uINT8_t c_get;
       易失性int I = 0;
       (i =8;i >0;i --)
       {
         c_get =(数据>> 28)和15;


         如果(c_get > 9)
           c_get +=7;

         c_get +=48;

         while (((sci->FLR & SCI_TX_INT)==0){/* WAIT */};

         sci->td = c_get;
         数据=数据<< 4;
       }
    }