|
我现在的程序是在wince6中,在S3c6410中调试没得问题,换了块板子,也是wince6的,不过是arm9内核的,接受数据就一次,以后就接受不到了,用wince串口调试工具,板子发送出来,pc机可以接收,pc机发送发给下位机接收不到,我的串口接收程序是这样的,在接收线程中
while (TRUE)
{
if (WaitCommEvent(ceSeries->m_hComm,&evtMask,0))
{
SetCommMask (ceSeries->m_hComm, EV_RXCHAR| EV_CTS | EV_DSR);
//GetCommMask(ceSeries->m_hComm, &evtMask);
//表示串口 收到字符
if (evtMask & EV_RXCHAR)
{
Sleep(10);
ClearCommError(ceSeries->m_hComm,&dwReadErrors,&cmState);
willReadLen = cmState.cbInQue ;
if (willReadLen <= 0)
{
continue;
}
readBuf = new BYTE[512];
ZeroMemory(readBuf,512);
//读取串口数据
ReadFile(ceSeries->m_hComm, readBuf, willReadLen , &actualReadLen,0);
}
}
}
|
|