初级会员

- 积分
- 81
- 金钱
- 81
- 注册时间
- 2015-6-15
- 在线时间
- 9 小时
|
发表于 2015-8-27 16:48:16
|
显示全部楼层
下面两种情况分别是收和发
while (1)
{
#ifdef SENDTOUSART //USB虚拟串口接收到的数据发送到串口
if((count_out!=0)&& (bDeviceState ==CONFIGURED)){ //表示usb有数据来了,存储在buffer_out中,长度为count_out
USB_Data_Deal(&buffer_out[0], count_out);//将usb接收到的数据处理
count_out=0; //清除标记
}
#else //向USB虚拟串口发送数据
UserToPMABufferCopy(buffer_in, ENDP1_TXADDR, sizeof(buffer_in)); //将要发送的数据拷到缓冲区,默认sizeof(buffer_in)不能超过64
SetEPTxCount(ENDP1, sizeof(buffer_in));
SetEPTxValid(ENDP1);
delay(0xffffff);
#endif
} |
|