发表于:2004-04-22 09:46:00
5楼
这段时间我碰到了一个问题就是,从串口读入数据每次只有一包的话,数据从串口进入的不丢,如果是多包的话有丢失现象,第一包完整,第二包丢部分,三包好了这样交叉出现,我得程序是:when(timer_expires(com_timer))
{
recvcount = 0;
recvcount = io_in(rs232_in, &serial_buf_in, 49);
if(recvcount == 0)
return;
memcpy(msg_out.data, &serial_buf_in[0], recvcount);
watchdog_update();
msg_out.code=0;
msg_out.dest_addr.bcast.type=BROADCAST;
msg_out.dest_addr.bcast.domain=0;
msg_out.dest_addr.bcast.backlog=0;
msg_out.dest_addr.bcast.rpt_timer=15;
msg_out.dest_addr.bcast.retry=3;
msg_out.dest_addr.bcast.tx_timer=15;
msg_out.dest_addr.bcast.subnet=0;
msg_out.service=UNACKD;
msg_out.tag=Tag_out;
msg_send();
return;
}望大家给我看看,是否有问题。