Microchip
直播中

何丽

7年用户 271经验值
私信 关注
[问答]

Uart字符串传输

嗨,我对使用Uart协议在循环中逐个字节地处理字符串的传输字节有一些困难。对于一个字符串传输,我使用了如下定义:const char*inputText=“请插入脉冲周期”;注意:这只适用于一个字符串for循环字符串transf我尝试使用definitionconst 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)

回帖(4)

张娜

2019-5-28 10:15:25
来自HTTP://www. McCHIP.COM/FUMMS/M96568ASPX

以上来自于百度翻译


      以下为原文

    comes from
http://www.microchip.com/forums/m965648.aspx
举报

李捷

2019-5-28 10:34:05
嗨,非常感谢你的反馈。现在我想发送N次预定义字符串。我所考虑的问题是,不知为什么,地址是错误的,传输的字节只传输相同的第一个字符。谁能给我一些反馈,告诉我代码中的错误?非常感谢你。

以上来自于百度翻译


      以下为原文

    Hi,
 
Thank you a lot for your feedback.
Right now I want to send N times the pre-defined string. The issue I am taking it is that somehow the addressing is wrong and the bytes that are transmitted only transmit the same first character.
 
Can anyone give some feedback about what it is wrong in my code? 
 
thank you a lot
举报

王焕树

2019-5-28 10:44:46
达里奥的观点是,如果你开始一个关于一个现存问题的新话题,这对于所有可能回答的人来说都是烦人的。继续第一个话题要好得多,所以我们不会失去先前的上下文。

以上来自于百度翻译


      以下为原文

    Dario's point is, it's annoyong for all the people who might answer if you start a new topic about an existing question.
It's much better just to continue in the first topic, so we don't lose the previous context.
 
举报

李捷

2019-5-28 10:56:07
好啊。谢谢你的信息,我将继续上一篇文章。请核对一下。

以上来自于百度翻译


      以下为原文

    ok. thank you for that information.
 
I will continue for the previous post. Please check.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分