beautypg.com

Erase, Write, Attiny2313 – Rainbow Electronics ATtiny2313 User Manual

Page 18

background image

18

ATtiny2313

2543A–AVR–08/03

Erase

To erase a byte, the address must be written to EEAR. If the EEPMn bits are 0b01, writ-
ing the EEPE (within four cycles after EEMPE is written) will trigger the erase operation
only (programming time is given in Table 1). The EEPE bit remains set until the erase
operation completes. While the device is busy programming, it is not possible to do any
other EEPROM operations.

Write

To write a location, the user must write the address into EEAR and the data into EEDR.
If the EEPMn bits are 0b10, writing the EEPE (within four cycles after EEMPE is written)
will trigger the write operation only (programming time is given in Table 1). The EEPE
bit remains set until the write operation completes. If the location to be written has not
been erased before write, the data that is stored must be considered as lost. While the
device is busy with programming, it is not possible to do any other EEPROM operations.

The calibrated Oscillator is used to time the EEPROM accesses. Make sure the Oscilla-
tor frequency is within the requirements described in “Oscillator Calibration Register –
OSCCAL” on page 26.