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

📄 dk3200_ee_demo.c

📁 ST公司的upsd dk2000评估板仿真eeprom的源程序。
💻 C
字号:
/*------------------------------------------------------------------------------
DK3200_1_demo.c

Simple EE Emulation Demo code for uPSD

06/2002 Ver 0.1 - Initial Version

Copyright 2002 ST Microelectronics
This example demo code is provided as is and has no warranty,
implied or otherwise.  You are free to use/modify any of the provided
code at your own risk in your applications with the expressed limitation
of liability (see below) so long as your product using the code contains
at least one uPSD products (device).

LIMITATION OF LIABILITY:   NEITHER STMicroelectronics NOR ITS VENDORS OR 
AGENTS SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
------------------------------------------------------------------------------*/

#pragma optimize(8,size)
#pragma SYMBOLS
#pragma NOAREGS

		

#include "upsd_hardware.h"		// environment hardware specific defines
#include "upsd3200.h"			// special function register declarations for UPSD

#include "lcd_io.h"				// prototype declarations and defines for uPSD IP drivers
#include "upsd_timer.h"
#include "eeprom.h"

#include <stdlib.h>

xdata PSD_REGS PSD8xx_reg _at_ PSD_REG_ADDR;  // Define PSD registers at address "csiop" space

   	  
void main (void) 
{
	unsigned char status;
	BYTE xdata buf[1];          //Buffer that holds data to write  
    BYTE xdata tmpbuf[1];       //Buffer which holds data read back from the flash
   	
//	WDKEY = 0x55;               // Turn off the Watch Dog Timer	  
    tmpbuf[0] = 0;              // Initialize the temp buffer  
    buf[0] = 0xAA;              // Load the data pattern to write 
	
	PSD8xx_reg.VM |= 0x80;      // enable peripheral I/O mode for LCD display

    timer0_init();   		 	// initialize timer0 interrupt 
	lcd_init();	  				// initialize LCD. 8 bits, 2 lines, 5x7 font,
     				  			// no blink, cursor off, clear 

	printfLCD("EEPROM Emulation\n");		//display on LCD
	delay_2sec();
	delay_2sec();
    lcd_clear();
  
   	Eeprom_Init();
  	status = EEPROM_Format(0x0001);   // Format one record

	status = Update_Record(0, &buf);  // Write record one with the content in buf[0] 

	printfLCD("Write_Record_0\n");		//display on LCD
	printfLCD("%x\n",buf[0]);
	delay_2sec();
    lcd_clear();

	Read_Record(0,&tmpbuf);           // read the records

	if (tmpbuf[0] == buf[0])          // Compare the record
	  {        
 	    printfLCD("Read & Compare_0\n");
	    printfLCD("Compared_OK: %x\n",tmpbuf[0]);
	    delay_2sec();
	    delay_2sec();
 	    status = 0;
//	    lcd_clear();
      } 
	else 
      {
	   printfLCD("Read & Compare_0\n");
	   printfLCD("Miscompared \n");
       delay_2sec();
	   lcd_clear();
	   status = Get_Sector_Status(SECTOR_0);
	   printfLCD("Rec Status: %x\n", status);
	   delay_2sec();
	   }
    while(1);
}  // End main



⌨️ 快捷键说明

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