我用CH376芯片查詢U盤總?cè)萘亢褪S嗳萘孔x出來的數(shù)據(jù)不對,插入32GU盤實際為29.71G,剩余14.19G,但讀出來的數(shù)據(jù)為總扇區(qū)0xB6C40009,剩余扇區(qū)0xC6684003,插入另外一個32GU盤實際為27.86G,剩余21.44G,讀出來的數(shù)據(jù)為總扇區(qū)0x7BD14009,剩余扇區(qū)0x63622003,文件系統(tǒng)都是FAT32;請教各位大神,幫我看下是哪里的問題,下面是我查詢?nèi)萘康拇a
void?QueryDiskSize(BYTE?mDiskNAme)
void QueryDiskSize(BYTE mDiskNAme)
{
BYTE mData0,mData1,mData2,mData3;
LONG mTimer;
mTimer=0;
CH376->mCH376CMD=DISK_QUERY;//<<8;
DelayUs(2);
while(INT_CH376==1){mTimer=mTimer+1;if(mTimer>5000000)return;}
mData0=CH376GetIntStatus();
if(mData0==USB_INT_SUCCESS)
{
CH376->mCH376CMD=RD_USB_DATA0;//<<8;
DelayUs(2);
//得出總?cè)萘?br> mData0=CH376->mCH376DAT;//>>8;
LCDStringData(100,150,"TCap=%H",mData0);
mData1=CH376->mCH376DAT;//>>8;
LCDStringData(200,150,"%H",mData1);
mData2=CH376->mCH376DAT;//>>8;
LCDStringData(250,150,"%H",mData2);
mData3=CH376->mCH376DAT;//>>8;
LCDStringData(300,150,"%H",mData3);
//mTemp2=mTemp2>>1;//得出總空間大小(以Kb為單位)
mSysRun.mDisk[mDiskNAme].mTotalCapacity=mData0|((WORD)mData1<<8)|((LONG)mData2<<16)|((LONG)mData3<< 24);//得出扇區(qū)數(shù)
//得出可用容量
mData0=CH376->mCH376DAT;//>>8;
LCDStringData(100,170,"FCap=%H",mData0);
mData1=CH376->mCH376DAT;//>>8;
LCDStringData(200,170,"%H",mData1);
mData2=CH376->mCH376DAT;//>>8;
LCDStringData(250,170,"%H",mData2);
mData3=CH376->mCH376DAT;//>>8;
LCDStringData(300,170,"%H",mData3);
//mTemp2=mTemp2>>1;//得出總空間大小(以Kb為單位)
mSysRun.mDisk[mDiskNAme].mFreeCapacity=mData0|((WORD)mData1<<8)|((LONG)mData2<<16)|((LONG)mData3<< 24);;
DelayUs(1);
mSysRun.mDisk[mDiskNAme].mFileSystem=CH376->mCH376DAT;
}
else
{
mSysRun.mDisk[mDiskNAme].mTotalCapacity=0;
mSysRun.mDisk[mDiskNAme].mFreeCapacity=0;
mSysRun.mDisk[mDiskNAme].mFileSystem=0;
}
SMatchingStringData("TotalCapacity=%H\r\n",mSysRun.mDisk[mDiskNAme].mTotalCapacity);
SMatchingStringData("mFreeCapacity=%H\r\n",mSysRun.mDisk[mDiskNAme].mFreeCapacity);
SMatchingStringData("mFileSystem=%H\r\n",mSysRun.mDisk[mDiskNAme].mFileSystem);
}
熱門產(chǎn)品 :
CH592: RISC-V內(nèi)核BLE5.4無線MCU