我单片机程序用的是CH375A51.asm和CH375INC.asm,PC机端程序用的是DEBUG372里的程序,但调试时下传数据没问题,上传数据接收不到 其中程序 UINT mThreadUp2(LPVOID pParam) //端点2上传线程 { UCHAR mBuf[mCH375_PACKET_LENGTH*8]; ULONG dlen,datalen; CCH372UpDownDlg *pDlg = (CCH372UpDownDlg *)pParam; pDlg->m_btnup2.EnableWindow(FALSE);
if(pDlg->m_open && pDlg->m_trdup2) //设备打开,线程启动 { /**************在线程中用CreateFile打开设备,因为每个句柄同一时候只能执行一个API**************************/ if ( pDlg->T2UHandle != INVALID_HANDLE_VALUE ) { // 打开设备成功 datalen = min( pDlg->m_uplen2, sizeof(mBuf)); dlen = datalen;
if(CH375ReadData((ULONG)pDlg->T2UHandle,&mBuf[0],&dlen)) { //操作成功输出数据 CHAR buffer[mCH375_PACKET_LENGTH*8*2+1]; ULONG i,j; for(i=0,j=0;i { sprintf(&buffer[j],"%02X",mBuf[i]); //输出值输出至哪里? j += 2; } buffer[j] = '\0'; pDlg->m_listup2.InsertString(-1,buffer); pDlg->m_uplen2 = dlen; } else if ( !pDlg->m_close ) MessageBox(NULL,"端点2上传失败!如果设备断开过那么请先关闭本程序","DEBUG372",MB_OK|MB_ICONSTOP); } } pDlg->m_btnup2.EnableWindow(TRUE); pDlg->m_trdup2 = FALSE; ExitThread(0); return 0; } 里面的sprintf(&buffer[j],"%02X",mBuf[i]); //输出值输出至哪里? 望各位大虾解答!万分感谢!