從U盤(pán)讀出來(lái)的數(shù)據(jù)為何是錯(cuò)的?

我用的是STC89C58RD+ 和CH375 ,要讀取的數(shù)據(jù)如下: 0x25, 0xb1, 0xb1, 0x10, 0x01, 0x02, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xd8, 0xcf, 0xc2, 0xa3, 0xb1, 0xb3,0xac, 0xca, 0xd0, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xca, 0x25, 0x01,0x01, 0x10, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5,0xd8, 0xcf, 0xc2, 0xa3, 0xb1, 0xb3, 0xac, 0xca, 0xd0, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,0xa1, 0xa1, 0xa1, 0xcb, 0x25, 0x01, 0x01, 0x10, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xd8, 0xcf, 0xc2, 0xa3, 0xb1, 0xb,........... 選用的庫(kù)是ch375hft.c ,并口連接,讀數(shù)據(jù)部分代碼如下: TotalCount = 600; printf( "′ó???t?Dμú8??×??ú?aê??á: \n" ); while ( TotalCount ) { if ( TotalCount > MAX_BYTE_IO ) c = MAX_BYTE_IO; else c = TotalCount; mCmdParam.ByteRead.mByteCount = c; i = CH375ByteRead( ); mStopIfError( i ); TotalCount -= mCmdParam.ByteRead.mByteCount; for( i=0;i{ ch = mCmdParam.ByteRead.mByteBuffer[i]; switch(ch) { case 'x': { next1=mCmdParam.ByteRead.mByteBuffer[i+1]; next2=mCmdParam.ByteRead.mByteBuffer[i+2]; if((next1>=0x30)&&(next1<=0x39)) { next1=next1-0x30; } else if((next1>=0x61)&&(next1<=0x66)) { next1=next1-0x61+10; } else printf("error1"); if((next2>=0x30)&&(next2<=0x39)) { next2=next2-0x30; } else if((next2>=0x61)&&(next2<=0x66)) { next2=next2-0x61+10; } else printf("error2"); bao[datalen]= next1*16 + next2; datalen++; count++; } break; default: break; } } if(count%38==0) { for(i=0;i } datalen=0; count=0; mDelay100mS(); } } 問(wèn)題: 目前的情況是只能讀取前38個(gè)數(shù) ,38個(gè)數(shù)以后的數(shù)據(jù)就全是錯(cuò)誤了,請(qǐng)問(wèn)該如何做?才能把所有數(shù)據(jù)都讀出來(lái),幫幫忙,謝謝


熱門(mén)產(chǎn)品 : USB3.0 HUB控制器:CH634

讀出38?jìng)€(gè)字節(jié)后將指針跳到38?jìng)€(gè)字節(jié)后,再繼續(xù)讀.例如: k=0; while(TotalCount) {     c=20;     mCmdParam.ByteLocate.mByteOffset = k*c;     CH375ByteLocate( );     mCmdParam.ByteRead.mByteCount = c;     CH375ByteRead( ); TotalCount -= mCmdParam.ByteRead.mByteCount; /* 計(jì)數(shù),減去當(dāng)前實(shí)際已經(jīng)讀出的字符數(shù) */      k++; }


loveapple,我有點(diǎn)沒(méi)明白你的意思 上邊的那個(gè)C=20; 這里的C 是地址嗎? 第二個(gè)38個(gè)數(shù)據(jù) 我還是沒(méi)有讀出來(lái)呀


c是每次讀的字節(jié)數(shù),這段程序是每次讀20字節(jié)數(shù)據(jù),那你這樣做下,直接跳到38字節(jié)后,讀第2個(gè)38字節(jié)數(shù),看能不能讀出來(lái). mCmdParam.ByteLocate.mByteOffset = 38; CH375ByteLocate( ); mCmdParam.ByteRead.mByteCount = 38; CH375ByteRead( );


還是不行啊,第2個(gè)38個(gè)數(shù)出不來(lái)啊 ,我把程序發(fā)給你,您幫我看下,好嗎 ?


將完整程序發(fā)到tech@wch.cn


發(fā)過(guò)去了 ,麻煩您幫我看下,謝謝


我又給您發(fā)過(guò)去一個(gè)EMAIL ,麻煩您幫我看下,謝謝


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频