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

📄 main1.c

📁 单的SD卡读写程序--根据网上的程序跟改
💻 C
字号:
/****************************************Copyright (c)**************************************************
**                               广州周立功单片机发展有限公司
**                                     研    究    所
**                                        产品一部 
**
**                                 http://www.zlgmcu.com
**
** 文   件   名: main.c
** 最后修改日期: 2004年11月15日
** 描        述: 用户应用程序
** 版	     本: V5.0
**********************************************************************************************************/
#include "..\inc\44b0x.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
//#include "..\inc\option.h"
#include "..\inc\def.h"
#include "DataType.h"
#include <stdarg.h>
#include <string.h>
#include"stdio.h"

#define EXT_OSC_CLK 10000000
int  MCLK;
//extern short y;


TIME_STRUC SysTime;
int SERIAL_BAUD = 0x1C200;
char table_begin[] = "/***************************************************************/\n";

void ShowSysClock(int argc, char *argv[])
{
	/*
	printf("System is running @%dHz\n", MCLK);	
	不能使用printf做为串口输出函数
	因为它是库函数,会出现一些编译错误。
	如下所示:
	Error   : L6239E: Cannot call ARM symbol 'free' in non-interworking object 44blib.o from THUMB code in stdio.o(.text)
	
	作串口输出要使用Uart_Printf函数,原型在44blib.c中。
	*/
	Uart_Printf("System is running @%dHz\n", MCLK);	
}

void ChangePllValue(int mdiv, int pdiv, int sdiv)
{
	int i = 1;		
	
	rPLLCON = (mdiv<<12)|(pdiv<<4)|sdiv;
	
	while(sdiv--)
		i *= 2;	
	
	MCLK = (EXT_OSC_CLK*(mdiv+8))/((pdiv+2)*i);		
}

void Main()
{
	unsigned char i;	
	unsigned char Combuf[8];
	unsigned char Receive_ready = 0;
	int Check_sum = 0;
	unsigned char Buf[200];


	
//	ChangePllValue(72, 3, 2);	//修改系统主频为2倍频
	ChangePllValue(0x28, 2, 1); //60MHz
	Port_Init();
	Uart_Init(60000000,115200);
	Uart_Select(0);
//	Uart1_Init(40000000,115200);
	

	Uart_Printf(table_begin);	
	ShowSysClock(0, NULL);	
	Uart_Printf("Serial Baud rate is %d\n", SERIAL_BAUD);
	Uart_Printf("Build date:");
	Uart_Printf(__DATE__);
	Uart_Printf("-");
	Uart_Printf(__TIME__);
//	next_line();
	Uart_Printf(table_begin);
	
	SysTime.year    = 3;
	SysTime.month   = 7;
	SysTime.day     = 2;
	SysTime.weekday = 3;
	SysTime.hour    = 0x17;
	SysTime.min     = 0x09;
	SysTime.sec     = 0;
	
	
	
	Uart_Printf("System Initialized.\n");		
//	RequestSystemInterrupt();
//	Interrupt_init();

//	rINTMSK=~(BIT_EINT0 | BIT_GLOBAL|BIT_UTXD1|BIT_URXD1);
//	ARMEnableInt();						//设置外部中断0中断优先级
	MMC_Port_Init();
	MMC_Init();
	while(1)
	{
//		MMC_Port_Init();
//		MMC_Init();
		for(i = 0;i<200;i++)Buf[i] = 0;
		MMC_get_volume_info();
		MMC_get_data_LBA(99,100,Buf);
;
	}
}

⌨️ 快捷键说明

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