[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Macro to read /write long to eeprom

From: Eivind Sivertsen
Subject: Re: [avr-gcc-list] Macro to read /write long to eeprom
Date: Thu, 11 Aug 2005 10:21:10 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Another trick is not to clear the byte in eeprom before the write when
it is sufficient to only clear bits on order to store the value into
eeprom (you save half of the write). There is some datasheet on atmel
site about this.

Which datasheet, please? Which AVR?

For example, the mega48/88/168 has this. It is controlled using bits in the EECR register. It is possible to program EE data in one atomic operation (erase location AND program location), or to split it into two operations. The write operation can only do 1->0, the erase takes care of 0->1 for the flash cells in EE. So, you can use this in a manner like Peter B. checks every byte to avoid overwriting identical values: if a cell is 0xff; there's no need to erase it before writing; which saves time. If you want a byte -> 0xff, do only erase etc... If you know positively that the only change you need to do is clear a few bits in the existing value; that can be done too...save the erase. This kind of book-keeping takes a few cycles, though probably not in the ms range...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]