Programming the eeprom, Atmega161(l) – Rainbow Electronics ATmega161L User Manual
Page 122

122
ATmega161(L)
1228C–AVR–08/02
Programming the EEPROM
The programming algorithm for the EEPROM Data memory is as follows (refer to “Pro-
gramming the Flash” for details on command, address and data loading):
1.
A: Load Command “0001 0001”.
2.
H: Load Address High Byte ($00 - $01)
3.
B: Load Address Low Byte ($00 - $FF)
4.
E: Load Data Low Byte ($00 - $FF)
L: Write Data Low Byte
1.
Set BS to “0”. This selects low data.
2.
Give WR a negative pulse. This starts programming of the data byte. RDY/BSY
goes low.
3.
Wait until to RDY/BSY goes high before programming the next byte.
(See Figure 78 for signal waveforms.)
The loaded command and address are retained in the device during programming. For
efficient programming, the following should be considered:
•
The command needs to be loaded only once when writing or reading multiple
memory locations.
•
Address High byte only needs to be loaded before programming a new 256-word
page in the EEPROM.
•
Skip writing the data value $FF, that is, the contents of the entire EEPROM after a
Chip Erase.
These considerations also apply to Flash, EEPROM and Signature bytes reading.
Figure 78. Programming the EEPROM Waveforms
$11
ADDR. HIGH
ADDR. LOW
DATA LOW
DATA
XA1
XA2
BS1
XTAL1
RDY/BSY
RESET
WR
OE
+12V
BS2
PAGEL