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.

[参考译文] 从 UART 打印数据

Guru**** 2540720 points
Other Parts Discussed in Thread: CC2530

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/622737/printing-data-from-uart

主题中讨论的其他器件:CC2530

您好!

我使用的是连接 CC2530芯片的 SmartRF 05评估板版本1.8.1。

我想修改 SampleHeatingCoolingUnit 代码以显示来自 UART 的数据。 因此、当我从 UART (RealTerm 程序)发送内容时、我希望在 LCD 显示屏上显示该内容。

静态 uint16 HalUARTReadDMA (uint8 * buf、uint16 len)

 uint16 cnt;
 对于(cnt = 0;cnt < len;cnt++)
 {
   if (!HAL_UART_DMA_new_RX_BYTE (dmaCfg.rxHead))
   {
     中断;
   }
   *buf++= HAL_UART_DMA_GET_RX_BYTE (dmaCfg.rxHead);
   HAL_UART_DMA_CLR_RX_BYTE (dmaCfg.rxHead);
#if HAL_UART_DMA_RX_MAX == 256
   (dmaCfg.rxHead)++;
其他
   if (++(dmaCfg.rxHead)>= HAL_UART_DMA_RX_MAX)
   {
     dmaCfg.rxHead = 0;
   }
#endif
   字符 str[10];
   sprintf (str、"UART:%d"、(uint32) dmaCfg.rxBuf[0]);
   HalLcdWriteString (str、HAL_LCD_LINE_1);
   HalLcdWriteValue ((uint32) dmaCfg.rxHead、10、HAL_LCD_LINE_2);
   HalLcdWriteValue((UINT32) buf,10,HAL_LCD_LINE_3 );
 }
 PxOUT &=~HAL_UART_Px_RTS; //重新启用任何读取操作的流程。
 
 
 返回 cnt;

每当我尝试显示值时、我都会得到缓冲区大小和发送的数据量、绝不会精确地显示我发送的字符串。

我现在陷入了困境,不知道该怎么办,有人可以帮助我吗?

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

    您好!

    这基于 CC25xx 器件、请在相应的论坛上发布您的查询。 此论坛适用于 C2000 MCU。



    此致、
    Gautam

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    好的、抱歉我没有注意到我在错误的部分发布