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

📄 main.c

📁 平台:s3c44b0
💻 C
字号:
#include "..\INC\44BLIB.h"

#include "flash.h"

void Main(void)
{
	int  i;
	char ch;
	INT16U  ReadData;
	Uart_Init(0,57600);
	Uart_Select(0);
	Uart_Printf("\n**********************        嵌入式开发       ****************************");
	Uart_Printf("\n**********************  Flash读写擦除操作实例  ****************************");
	Uart_Printf("\n**********************         houanhua        ****************************");    
	Uart_Printf("\n**********************     houanhua@163.com    ****************************");	
	Uart_Printf("\n请输入回车开始扇区操作");
	ch= Uart_Getch();
	
	if(ch=='\r')
	{
    	SST39VF160_SectorErase(0xf7800);
		   Uart_Printf("\n扇区已经擦除!");
		   Uart_Printf("\n开始写入数据0x8205...");
		   for(i=0;i<5;i++)
		   {
		      if(SST39VF160_WordProg(0xf7800+i,0x8205))
		      {
		      	Delay(2);
		      }
		      else
		      	  Uart_Printf("地址%5x处写入错误",i+0xF7800);
		   }
		   Uart_Printf("\n写操作完毕,开始读取写入数据0x8205... ");   
           for(i=0;i<5;i++)
           {
              ReadData = Readflash(0xf7800+i);
              if(ReadData = 0x8205)
              {
              	 Uart_Printf("\n地址%5x处读取的值是%4x !",i+0xF7800,ReadData);	      
		      }
		   }
		   Uart_Printf("\n扇区操作验证成功");
	}
	Uart_Printf("\n请输入回车开始块操作:");	
	ch= Uart_Getch();
	if(ch=='\r')
	{
		SST39VF160_BlockErase(0xf7800);
		Uart_Printf("\n块已经擦除!");
 		Uart_Printf("\n开始写入数据0x8309");
		   for(i=0;i<5;i++)
		   {
		      if(SST39VF160_WordProg(0xf7800+i,0x8309))
		      {
		      	Delay(2);
		      }
		      else
		      	 Uart_Printf("地址%d处写入错误",i+0xF7800);
		   }
		   Uart_Printf("\n写写操作完毕,开始读取写入数据0x8309... ");   
           for(i=0;i<5;i++)
           {
              ReadData = Readflash(0xf7800+i);
              if(ReadData = 0x8309)
              {
              	 Uart_Printf("\n地址%5x处读取的值是%4x !",i+0xF7800,ReadData);
		      }
		   }
		   Uart_Printf("\n块操作验证成功!");
	}
}

⌨️ 快捷键说明

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