eeprom.c

来自「AVR单片机的C语言源程序,包括按键扫描EEPROM通讯LCD显示数码管显示等等」· C语言 代码 · 共 40 行

C
40
字号
// EEPROM access example

// CodeVisionAVR C Compiler
// (C) 2000-2002 HP InfoTech S.R.L.
// www.hpinfotech.ro

// Chip: AT90S2313
// Memory Model: TINY
// Data Stack Size: 64 bytes

flash char f[]="This is a test";
#pragma warn-
eeprom char e[16];
#pragma warn+
char r[16];

void main (void)
{
char flash *ptr_to_flash;
char eeprom *ptr_to_eeprom;
char *ptr_to_ram;

// copy the string f from FLASH to
// the string e in EEPROM
ptr_to_flash=f;
ptr_to_eeprom=e;
while (*ptr_to_flash)
      *ptr_to_eeprom++=*ptr_to_flash++;

// copy the string e from EEPROM to
// the string r in RAM
ptr_to_eeprom=e;
ptr_to_ram=r;
while (*ptr_to_eeprom)
      *ptr_to_ram++=*ptr_to_eeprom++;

// stop here
while (1);
}

⌨️ 快捷键说明

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