вот ведь в хэлпе всё есть
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено nut 22 сентября 2004 г. 15:49
В ответ на: Подскажите как разместить констатнту в ЕЕПРОМ памяти АВР микроконтроллера в программе на Си написаной в среде ImageCraft. Буду признателен за ответ. отправлено mapic 22 сентября 2004 г. 15:09

Initializing EEPROM

EEPROM can be initialized in your program source file by allocation global variable to a special area called "eeprom." In C source, this can be done using pragmas. See Program Areas for discussion on different program areas. The resulting file is .eep. For example,

#pragma data:eeprom

int foo = 0x1234;

char table[] = { 0, 1, 2, 3, 4, 5 };

#pragma data:data

...

int i;

EEPROM_READ((int)&foo, i); // i now has 0x1234

The second pragma is necessary to reset data area name back to the default "data."

Note that to work around the hardware bug in AVR, location 0 is not used for initialized EEPROM data.

Note that when using in an external declaration (e.g. accessing foo in another file), you do not use the pragma. For example, in another file:

extern int foo;

int i;

EEPROM_READ((int)&foo, i);

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru