Forum: Projekte & Code eeprom beispiele für cvavr


von Winfried J. (Firma: Nisch-Aufzüge) (winne) Benutzerseite


Lesenswert?

/ 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);
}

von Winfried J. (Firma: Nisch-Aufzüge) (winne) Benutzerseite


Lesenswert?

void eprintf(char eeprom *ptr)
{
char d[1];
while (*ptr)
      {*d=*ptr++;
       putchar(*d);};
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.