我單片機程序用的是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打開設備,因為每個句柄同一時候只能執(zhí)行一個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上傳失?。∪绻O備斷開過那么請先關閉本程序","DEBUG372",MB_OK|MB_ICONSTOP); } } pDlg->m_btnup2.EnableWindow(TRUE); pDlg->m_trdup2 = FALSE; ExitThread(0); return 0; } 里面的sprintf(&buffer[j],"%02X",mBuf[i]); //輸出值輸出至哪里? 望各位大蝦解答!萬分感謝!