On Thu, 24 Nov 2005, David Kelly wrote: > > On Nov 24, 2005, at 6:49 AM, ìì§ì wrote: > > > hi, > > > > I am using atmega128 mic. > > i want program memory to store data, not eeprom. > > At avrlibc, the file of pgmspace.h provide the function to read the > > program memory. > > But I can't find the function to write the program memory. > > how to write specific value to program memory? > > Its hard to write to FLASH program memory so its not done very often > other than to write executable code and constant data. Also in > general FLASH memory can not be reprogrammed as many times before > breaking than EEPROM cells. > > EEPROM is much easier to write but harder to read than FLASH because > the AVR EEPROM is not in either of the CPU memory spaces. The > solution I use for read-often variables is to declare a structure > containing all my EEPROM variables. Then create two allocations of > that structure, one in RAM and one in EEPROM. Usually call them ee > and wc, for EEprom and Working Copy, that its obvious ee.calibration > and wc.calibration are paired.
For large amounts of read-often data, you might consider keeping two copies in EEPROM. I have a factory default copy and a user-modified copy. It's an alternative for systems where RAM is limited and access to the constant can be slow; it works well for embedded systems that are connected to mechanical devices. --Kevin Neff _______________________________________________ AVR-GCC-list mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
