91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 201.31 KB
    文件類(lèi)型: .RAR
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2024-11-28
  • 語(yǔ)言: 其他
  • 標(biāo)簽: SPI讀寫(xiě)??SD卡??

資源簡(jiǎn)介

51模擬SPI讀寫(xiě)SD卡(包括Fat和Fat32文件系統(tǒng)),RAR中包含整個(gè)工程,可以用Keil直接打開(kāi)。采用軟件模擬SPI讀寫(xiě)SD卡,對(duì)于想用軟件模擬SPI有一定的借鑒性。

資源截圖

代碼片段和文件信息

#include?“common.h“
#include?“Fat.h“
#include?“Fat32.h“
#include?“DEVICE.H“
#include?“HAL.H“
////////////////////////////////////////
extern?SYS_INFO_BLOCK?xdata?DeviceInfo;
extern?FILE_INFO?xdata?ThisFile;
extern?unsigned?char?xdata?DBUF[BUFFER_LENGTH];
unsigned?char?xdata?FATBUF[512];
////////////////////////////////////////

unsigned?long?FirstSectorofCluster(unsigned?int?clusterNum)
{
unsigned?long?temp;
temp=clusterNum-2;
temp=temp*DeviceInfo.BPB_SecPerClus;
temp=temp+DeviceInfo.FirstDataSector;
return?temp;
}

unsigned?int?ThisFatSecNum(unsigned?int?clusterNum)
{

???unsigned?int?temp;
???temp=clusterNum/(DeviceInfo.BPB_BytesPerSec/2);
???temp=temp+DeviceInfo.FatStartSector;
???return?temp;

}

unsigned?int?ThisFatEntOffset(unsigned?int?clusterNum)
{????
return?(clusterNum%(DeviceInfo.BPB_BytesPerSec/2))*2;
}

unsigned?int?GetNextClusterNum(unsigned?int?clusterNum)
{
unsigned?int?FatSecNumFatEntOffset;

FatSecNum=ThisFatSecNum(clusterNum);
FatEntOffset=ThisFatEntOffset(clusterNum);
if(ThisFile.FatSectorPointer!=FatSecNum)
{

if(!SdReadSector(FatSecNum1FATBUF))
return?0xFFFF;
ThisFile.FatSectorPointer=FatSecNum;
}

///////////////////////////////////////////////////
clusterNum=FATBUF[FatEntOffset+1];
clusterNum=clusterNum<<8;
clusterNum+=FATBUF[FatEntOffset];
return?clusterNum;
}

unsigned?char?GoToPointer(unsigned?long?pointer)
{

unsigned?int?clusterSize;

clusterSize=DeviceInfo.BPB_SecPerClus*DeviceInfo.BPB_BytesPerSec;
ThisFile.ClusterPointer=ThisFile.StartCluster;
while(pointer>clusterSize)
{
pointer-=clusterSize;
ThisFile.ClusterPointer=GetNextClusterNum(ThisFile.ClusterPointer);
if(ThisFile.ClusterPointer==0xffff)
{
return?FALSE;
}
}
ThisFile.SectorofCluster=pointer/DeviceInfo.BPB_BytesPerSec;
ThisFile.SectorPointer=FirstSectorofCluster(ThisFile.ClusterPointer)+ThisFile.SectorofCluster;
ThisFile.OffsetofSector=pointer%DeviceInfo.BPB_BytesPerSec;
ThisFile.FatSectorPointer=0;
return?TRUE;

}

unsigned?char?DeleteClusterlink(unsigned?int?clusterNum)
{
unsigned?int?FatSecNumFatEntOffset;
unsigned?char?i;
while((clusterNum>1)&&(clusterNum<0xfff0))
{
FatSecNum=ThisFatSecNum(clusterNum);
FatEntOffset=ThisFatEntOffset(clusterNum);
if(SdReadSector(FatSecNum1DBUF))
{
?if(clusterNum ?clusterNum=DBUF[FatEntOffset+1];
?clusterNum=clusterNum<<8;
?clusterNum+=DBUF[FatEntOffset]; ?
}
else
return?FALSE;
DBUF[FatEntOffset]=0x00;
DBUF[FatEntOffset+1]=0x00;
for(i=0;i {
DelayMs(5);
if(!SdWriteSector(FatSecNum+i*DeviceInfo.BPB_FATSz161DBUF))
return?FALSE;
}
}
return?TRUE;
}

unsigned?int?GetFreeCusterNum(void)
{
unsigned?int?clusterNumi;
unsigned?long?sectorNum;
unsigned?char?j;
clusterNum=0;
// sectorNum=DeviceInfo.FatStartSector;

????

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----

?????文件???????6523??2003-12-13?06:09??51讀寫(xiě)SD卡源碼\AT89X52.H

?????文件?????191538??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\C51_UsbDisk

?????文件??????77873??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\C51_UsbDisk.hex

?????文件????????162??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\C51_UsbDisk.lnp

?????文件?????136944??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\C51_UsbDisk.M51

?????文件???????4084??2007-05-04?19:29??51讀寫(xiě)SD卡源碼\C51_UsbDisk.Opt

?????文件????????164??2007-05-04?19:29??51讀寫(xiě)SD卡源碼\C51_UsbDisk.plg

?????文件???????2336??2007-04-25?16:24??51讀寫(xiě)SD卡源碼\C51_UsbDisk.Uv2

?????文件???????4084??2007-04-29?12:49??51讀寫(xiě)SD卡源碼\C51_UsbDisk_Opt.Bak

?????文件???????2217??2006-08-19?09:52??51讀寫(xiě)SD卡源碼\C51_UsbDisk_Uv2.Bak

?????文件???????1078??2000-01-14?08:46??51讀寫(xiě)SD卡源碼\common.h

?????文件???????4046??2007-04-27?15:59??51讀寫(xiě)SD卡源碼\DEVICE.C

?????文件???????2055??2006-08-14?10:45??51讀寫(xiě)SD卡源碼\DEVICE.H

?????文件???????7343??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\DEVICE.LST

?????文件??????17248??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\DEVICE.OBJ

?????文件???????4625??2005-02-27?01:37??51讀寫(xiě)SD卡源碼\Fat.c

?????文件????????503??2004-05-08?04:04??51讀寫(xiě)SD卡源碼\Fat.h

?????文件??????10042??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\Fat.LST

?????文件??????21154??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\Fat.OBJ

?????文件???????4842??2005-02-27?01:39??51讀寫(xiě)SD卡源碼\Fat32.c

?????文件????????540??2003-06-01?07:54??51讀寫(xiě)SD卡源碼\Fat32.h

?????文件???????9941??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\Fat32.LST

?????文件??????23232??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\Fat32.OBJ

?????文件???????5070??2005-02-28?09:03??51讀寫(xiě)SD卡源碼\HAL.C

?????文件????????905??2005-02-28?21:28??51讀寫(xiě)SD卡源碼\HAL.H

?????文件???????9751??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\HAL.LST

?????文件??????14789??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\HAL.OBJ

?????文件??????30566??2007-04-26?09:56??51讀寫(xiě)SD卡源碼\HPI.C

?????文件???????1229??2003-06-04?09:34??51讀寫(xiě)SD卡源碼\hpi.H

?????文件??????77477??2007-04-29?12:48??51讀寫(xiě)SD卡源碼\HPI.LST

............此處省略16個(gè)文件信息

評(píng)論

共有 條評(píng)論