從NANDFLASH讀數(shù)據(jù)寫到U盤上, 總會(huì)有一些數(shù)據(jù)沒寫進(jìn)文件里 看看我這段代碼有沒問題
UINT32 i; UINT32 PageAddr; unsigned char pBuf0[528] = {0};
PageAddr=0; i = CH375FileCreate( ); mStopIfError(i); while( PageAddr < 32768 ) { //共32768頁 P10OUT ^= BIT5; PageRead(0, PageAddr, pBuf0); //從NANDFLASH讀一頁數(shù)據(jù), 一頁有528字節(jié) delay_us(50); PageAddr+=1; i = 0; for(n=0;n<528;n++) { //serial_put_char(pBuf0[n]); mCmdParam.ByteWrite.mByteBuffer[i] = pBuf0[n]; i+=1; if (i == 24) //一次寫入24個(gè)字節(jié), 528/24=22次 { mCmdParam.ByteWrite.mByteCount = (UINT8)i; i = 0; CH375ByteWrite( ); // 向文件寫入數(shù)據(jù) P10OUT ^= BIT6; } } }