新手入门
- 积分
- 23
- 金钱
- 23
- 注册时间
- 2014-4-21
- 在线时间
- 0 小时
|
发表于 2014-4-24 16:33:46
|
显示全部楼层
回复【13楼】 正点原子 :
---------------------------------
用CyPress的 EZ-USB FX2LP CY7C68013A 进行上位机编程获取下位机采集到的数据进行显示,用的是例程BulkLoop的程序,线程如下:
UINT XferLoop( LPVOID params )
{
OVERLAPPED inOvLap;//,outOvLap;
CBulkLoopDlg *dlg = (CBulkLoopDlg *) params;
LONG xfer = readSize; //每次读取数据的大小
PUCHAR dataBuf = rgb565Buf;
bool success;
inOvLap.hEvent = CreateEvent(NULL, false, false, "CYUSB_IN");
dlg->m_StatusLabel.SetWindowText(" STATUS: Transferring data . . .");
dlg->m_SuccessCount.SetWindowText("0");
dlg->m_FailureCount.SetWindowText("0");
dlg->InEndpt->TimeOut = 200;
for(int i=0; i<rgb565Size/readSize; i++)
{
// Use temp var because XferData can change the value of len
UCHAR *inContext = dlg->InEndpt->BeginDataXfer(rgb565Buf,xfer,&inOvLap);
dlg->InEndpt->WaitForXfer(&inOvLap,200);
success = dlg->InEndpt->FinishDataXfer(rgb565Buf,xfer, &inOvLap,inContext);
rgb565Buf += readSize;
}
CloseHandle(inOvLap.hEvent);
dlg->m_StatusLabel.SetWindowText(" STATUS: Stopped");
dlg->XferThread = NULL;
dlg->USBDevice->Close();
return true;
}
但用得到的数据还原的图像总是下面这样,请问,可能在哪方面出现错误,
|
|