STD116155617 发表于 2011-9-13 19:50:56

STM32串口中断接收数据问题。。求解。无法接收超过3个字符以上的数据

函数我都差不多是按那个SHELL里面的来写的。应该没问题啊。。如果是一个个发送的话。那数据是完全可以接收完成的
static rt_err_t irmodule_rx_ind(rt_device_t dev, rt_size_t size)
{
        RT_ASSERT(irmodule != RT_NULL);
        rt_sem_release(&irmodule->rx_sem);
        return RT_EOK;
}/*
回调函数
while(1)
{
        if(rt_sem_take(&irmodule->rx_sem, RT_WAITING_FOREVER) != RT_EOK)
        {
                continue;
        }
        while(rt_device_read(ir_uart, 0, &temp, 1) == 1)
        {
        ir_rx_buffer = temp;       
        if(count == 0x0d )
                        {
                                rt_thread_delay(15);       
                        }
                        count++;
                        }       
                               
                       
                //}
        }

STD116155617 发表于 2011-9-13 19:56:34

回复【楼主位】STD116155617
-----------------------------------------------------------------------

函数我都差不多是按那个SHELL里面的来写的。应该没问题啊。。如果是一个个发送的话。那数据是完全可以接收完成的
static rt_err_t irmodule_rx_ind(rt_device_t dev, rt_size_t size)
{
        RT_ASSERT(irmodule != RT_NULL);
        rt_sem_release(&irmodule->rx_sem);
        return RT_EOK;
}/*
回调函数
while(1)
{
        if(rt_sem_take(&irmodule->rx_sem, RT_WAITING_FOREVER) != RT_EOK)
        {
                continue;
        }
        while(rt_device_read(ir_uart, 0, &temp, 1) == 1)
        {
          ir_rx_buffer = temp;       
          if(count == 0x0d )
          {
                rt_thread_delay(15);       
          }
           count++;
          }       
}
数据接收部份。。
如果我数据是一个个发送的话。那个数据是完全可以接收的。这个没有问题。
如果我是一次发送多个的话。比如0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88 0x99 0x99 0x0d这样子吧。。他就只能接收到0x33这样子。。然后的都接收不到了。。第四个开始那个码就已经不对了。。一共接收到5个或者4个第是后面两个都是错误的啦。。接收全。。这个是什么问题呢。我波特率是115200应该能响应得过来才是
因为我一个个发送过去的单片机的话。。接收的话。是完全没有问题的,一串就了问题只。急急急。。麻烦一下啦。。好心的话加一个我QQ。。1161555617感谢您,谢谢谢谢
页: [1]
查看完整版本: STM32串口中断接收数据问题。。求解。无法接收超过3个字符以上的数据