【文件属性】:
文件名称:msp430 fat16读写文件
文件大小:103KB
文件格式:ZIP
更新时间:2018-09-28 05:00:48
msp430 fat16
msp430 fat16读写文件
#include
#include "mmc.h"
#include "fAT16.h"
#include "InitSys.c"
#include
#include
unsigned long cardSize = 0;
unsigned char status = 1;
unsigned int timeout = 0;
uint16 i = 0;
uint64 j = 0;
#define CPU_F ((double)8000000)
#define delay_us(x) __delay_cycles((long)(CPU_F*(double)x/1000000.0))
#define delay_ms(x) __delay_cycles((long)(CPU_F*(double)x/1000.0))
unsigned char buffer[512];
int main( void )
{
WDTCTL = WDTPW + WDTHOLD;
InitSys();
P2DIR = 0x0F;
P2OUT = 0xFf;
//Initialisation of the MMC/SD-card
while (status != 0) // if return in not NULL an error did occur and the
// MMC/SD-card will be initialized again
{
status = initMMC();
timeout++;
if (timeout == 50) // Try 50 times till error
{
printf ("No MMC/SD-card found!! %x\n", status);
break;
}
}
while ((mmc_ping() != MMC_SUCCESS)); // Wait till card is inserted
// Read the Card Size from the CSD Register
cardSize = MMC_ReadCardSize();
ReadBPB();
CreateFile("TEST0001TXT");
P2OUT &= ~BIT0;
//OperateFile
for(j = 0 ; j < 200 ; j++)
{ for (i = 0; i <= 512; i++) buffer[i] = 'B';
OperateFile(1,"TEST0001TXT",0 + j*512,512,buffer);
delay_ms(5);
P2OUT ^= BIT1;
}
P2OUT &= ~BIT2;
}
【文件预览】:
msp430 fat16读写程序
----Debug()
--------Obj()
--------List()
--------Exe()
----mmc.c(18KB)
----MSP430_SD.eww(163B)
----FAT16.h(5KB)
----修改记录.txt(495B)
----Config.h(4B)
----MSP430_SD.dep(4KB)
----MMC.h(5KB)
----Backup of MSP430_SD.ewd(17KB)
----InitSys.c(483B)
----FAT16.c(13KB)
----Backup of MSP430_SD.ewp(46KB)
----readme.txt(1KB)
----settings()
--------MSP430_SD.dbgdt(6KB)
--------MSP430_SD.wsdt(4KB)
--------MSP430_SD.dni(2KB)
--------MSP430_SD.cspy.bat(1KB)
----usage_example_IAR()
--------mmc.c(21KB)
--------MSP430_SD.eww(163B)
--------FAT16.h(5KB)
--------MSP430_SD.dep(4KB)
--------MMC.h(5KB)
--------FAT16.c(13KB)
--------readme.txt(1KB)
--------settings()
--------MSP430_SD.ewp(45KB)
--------MSP430_SD.ewd(13KB)
--------main.c(6KB)
----MSP430_SD.ewp(49KB)
----path.txt(0B)
----MSP430_SD.ewd(20KB)
----main.c(2KB)