⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmcmain.c

📁 基于SPI方式的MMC卡的FAT代码,可修改用于SD卡的管理.
💻 C
字号:
/**********************************************************************************************
**
**	Copyright(c) Semitek
**
**	模 块 名:mmcmain.c
**
**	模块功能:测试用
**
**	修改日期:2007年4月5日
**
**********************************************************************************************/
#include <LPC213X.H>
#include "type.h"
#include "spi_mmc.h"
#include "mmcmain.h"
#include "fat.h"
#include "string.h"

extern BYTE MMCWRData[MMC_DATA_SIZE];
extern BYTE MMCRDData[MMC_DATA_SIZE];


void Delay(DWORD delay)
{
	DWORD i;
	for(i=0;i<=delay;i++);
}

BYTE WriteData[]=
"\r\n******************Copyright (c)********************\r\n\
The LPC2131/32/34/36/38 microcontrollers are based on a 16/32-bit\r\n\
ARM7TDMI-S CPUwith real-time emulation and embedded trace support,\r\n\
that combine the microcontrollerwith 32kB, 64kB, 128kB, 256kB and\r\n\
512 kB of embedded high-speed ?ash memory. A128-bit wide memory\r\n\
interface and a unique accelerator architecture enable 32-bit\r\n\
codeexecutionatmaximumclockrate.Forcriticalcodesizeapplications,\r\n\
thealternative16-bitThumb mode reduces code by more than 30% with\r\n\
minimal performance penalty.Due to their tiny size and low power\r\n\
consumption, these microcontrollers are ideal forapplications where\r\n\
miniaturization is a key requirement, such as access control\r\n\
andpoint-of-sale. With a wide range of serial communications\r\n\
interfaces and on-chip SRAMoptions of 8kB, 16kB, and 32kB, they\r\n\
are very well suited for communication gatewaysand protocol\r\n\
converters, soft modems, voice recognition and low-end imaging,\r\n\
providingboth large buffer size and high processing power. Various\r\n\
32-bit timers, single or dual10-bit 8-channel ADC(s), 10-bit DAC,\r\n\
PWM channels and 47 GPIO lines with up to nineedge or level sensitive\r\n\
external interrupt pins make these microcontrollers particularlysuitablev\r\n\
for industrial control and medical systems.\r\n\
\r\n\
\r\n***********************ARM*****************************\r\n";

int main (void) 
{	
	
	char *FileName = "haha.tXt";
	DWORD FileLength = sizeof(WriteData);

	PINSEL1 = 0x40004000;

	SPI_Init();

	IODIR1 = 0x00030000;
   
	if ( mmc_init() != 0 )
	{
		IOSET0 = SPI_SEL;
		IODIR1 = 0x000F0000;
		while ( 1 );//初始化失败,进入死循环,等待复位
	}

	IODIR1 = 0x000C0000;

	GetFatInfo();
 
	IODIR1 = 0x00300000;

	CreateFile(FileName,WriteData,FileLength);

	IODIR1 = 0x00C00000;
	while (1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -