网上下的wince下的串口控件,只能输出不能接收!在线等!
下面是程序源码,计算机发送数据,wince根本就接受不到数据,而wince科研发送数据,计算机能够正常接收!调试发现if (ComStat.cbInQue > 0) 这个条件总是不满足,所以根本没有进行readfile操作,希望大家能够帮助!还有一点是,读串口操作是在主程序中按照启动线程来操作的!
if (ComStat.cbInQue > 0)
{
OVERLAPPED ovlCommPort = new OVERLAPPED();
int BytesRead = 0;
ReadFile(hComm, commRead, NumBytes, ref BytesRead, ref ovlCommPort);
//ReadFile(hComm, commRead, NumBytes, ref BytesRead,0);
return BytesRead;
}
else
{
//MessageBox.Show("Buff中没有数据");
return 0;
}