天嵌 ARM开发社区

 找回密码
 注册
查看: 1645|回复: 2

串口收发数据,部分正确部分错误,困惑,请高手指点

[复制链接]
0backspace0 发表于 2011-1-17 09:17:14 | 显示全部楼层 |阅读模式
现在发现一个怪现象,我把接收的数据进行了转换,转成10进制,但是在0x41-0x5b和0xc0-0xde之间的数据显示不对 显示的是(0x41+0x20)-(0x5b+0x20)和(0xc0+0x20)-(0xde+0x20)的数据,其他都是对的,麻烦各位看下我写的程序,看看问题出在哪
void uart::readUart()
{
   int cnt_read;
   char show_buff[20];

   if(open_flag == 1)
   {
       cnt_read = serial_read();
       if(cnt_read == 7)
       {
           show_buff[0]='T';
           show_buff[1]='P';
           show_buff[2]='-';
           show_buff[3]=uart_buff[2]/100+48;
           show_buff[4]=uart_buff[2]%100/10+48;
           show_buff[5]=uart_buff[2]%10+48;
           show_buff[6]=' ';
           show_buff[7]=' ';
           show_buff[8]=' ';
           show_buff[9]=' ';
           show_buff[10]='L';
           show_buff[11]='F';
           show_buff[12]='P';
           show_buff[13]='-';
           show_buff[14]=uart_buff[4]/100+48;
           show_buff[15]=uart_buff[4]%100/10+48;
           show_buff[16]=uart_buff[4]%10+48;
           show_buff[17]=' ';
           show_buff[18]='\n';
           show_buff[19]='\0';

            ui->textEdit_rx->setText(show_buff);

       }
   }
shabby 发表于 2011-1-26 14:36:39 | 显示全部楼层
没看明白你要干什么,再解释的清楚些
embedsky_lhh 发表于 2011-1-26 17:35:40 | 显示全部楼层
“但是在0x41-0x5b和0xc0-0xde之间的数据显示不对 显示的是(0x41+0x20)-(0x5b+0x20)和(0xc0+0x20)-(0xde+0x20)的数据,”是用PC机发送吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-10-6 05:09 , Processed in 1.039972 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表