嗨,我对使用Uart协议在循环中逐个字节地处理字符串的传输字节有一些困难。对于一个字符串传输,我使用了如下定义:const char*inputText=“请插入脉冲周期”;注意:这只适用于一个字符串for循环字符串transf我尝试使用defini
tionconst char inputText[]=“请插入脉冲周期”;const char*inputStr;以及以下状态:情况APP_UART_STATE_SEND_MESSAGE:{inputStr=inputText;for(count=0;count
以上来自于百度翻译
以下为原文
Hi,
I am having some difficulties to undertand and put to work the transmission byte by byte of a string in a loop using Uart protocol.
For one string transfer I used the definition:
const char* inputText = "Please insert the Period of Pulse";
NOTE: This worked only for one string
For loop string transfer I am trying to use the definition
const char inputText[] = "Please insert the Period of Pulse";
const char* inputStr;
and the following state:
case APP_UART_STATE_SEND_MESSAGE:
{
inputStr = inputText;
for (count=0; count
{
if(!(DRV_USART_TRANSFER_STATUS_TRANSMIT_FULL & DRV_USART_TransferStatus(appUartData.usartHandle)))
{
DRV_USART_WriteByte(appUartData.usartHandle, *inputStr);
*inputStr++;
}
}
appUartData.state = APP_UART_STATE_SEND_MESSAGE;
break;
}
However, with this state I received in the serial console the attached result. It seems that transmit only part of the first string and after only the first character of the string.
Anyone can help me to understand how to solve this issue?
thank you a lot
Attached Image(s)