www.pudn.com > bu1566.rar > fat32_main.c


/****************************************Copyright (c)************************************************** 
**                               Guangzou ZLG-MCU Development Co.,LTD. 
**                                      graduate school 
**                                 http://www.zlgmcu.com 
** 
**--------------File Info------------------------------------------------------------------------------- 
** File name:			main.c 
** Last modified Date:  2004-09-16 
** Last Version:		1.0 
** Descriptions:		The main() function example template 
** 
**------------------------------------------------------------------------------------------------------ 
** Created by:			Chenmingji 
** Created date:		2004-09-16 
** Version:				1.0 
** Descriptions:		The original version 
** 
**------------------------------------------------------------------------------------------------------ 
** Modified by: 
** Modified date: 
** Version: 
** Descriptions: 
** 
********************************************************************************************************/ 
#include "config.h" 
#include "string.h" 
#include "sdconfig.h" 
#include "sddriver.h"						/* SD卡操作的相关函数 */ 
 
#define CMD_SD_INIT		   0x00				/* SD卡初始化卡命令  */ 
#define CMD_SD_READ    	   0x01				/* SD卡读命令        */ 
#define CMD_SD_WRITE   	   0x02				/* SD卡写命令        */ 
#define CMD_SD_ERASE	   0x03				/* SD卡擦除命令      */ 
 
#define CMD_DATA_TRANS	   0x04				/* 将sd_buf中的数据发送到PC机 */ 
#define CMD_DATA_RECV	   0x05				/* 接收来自串口的数据,并放入sd_buf中 */ 
  
/* SD卡读写缓冲区,比SD卡一个块大8字节 */   
uint8 sd_buf[512]; 
 
int main (void) 
{ 
	uint8 temp; 
	uint16 record_addr; 
 
	uint32 bufaddr;														 
	uint32 blockaddr; 
	uint32 blocknum; 
	 
	temp = SD_Initialize();				/* 初始化SD卡 */ 
	EnumSdDev(); //读取sd卡系统信息    
	CreateFile(0,"abcdef.jpg",0);//创建文件,文件名为8位 
	WriteFile(len,ubuf);//写数据,len=数据长度,ubuf=数据 
	return 0; 
}