
181
ATmega8515(L)
2512A–AVR–04/02
Programming the Flash The Flash is organized in pages, see Table89 on page 179. When programming the
Flash, the program data islatched into a page buffer.This allows one page ofprogram
data to be programmedsimultaneously.The following procedure describeshow to pro-
gram theentire Flash memory:
A. LoadCommand “Write Flash”
1. Set XA1,XA0 to “10”. This enablescommandloading.
2. Set BS1to“0”.
3. Set DATA to “0001 0000”. This is the commandforWrite Flash.
4. Give XTA L1apositive pulse. Thisloads the command.
B. Load Address Lowbyte
1. Set XA1,XA0 to “00”. This enables address loading.
2. Set BS1to“0”.Thisselectslow address.
3. Set DATA = Address lowbyte ($00 -$FF).
4. Give XTA L1apositive pulse. Thisloads theaddress lowbyte.
C. LoadData LowByte
1. Set XA1,XA0 to “01”. This enablesdata loading.
2. Set DATA =Data lowbyte ($00 -$FF).
3. Give XTA L1apositive pulse. Thisloads the data byte.
D. LoadData HighByte
1. Set BS1to“1”.Thisselectshighdata byte.
2. Set XA1,XA0 to “01”. This enablesdata loading.
3. Set DATA =Data highbyte ($00 - $FF).
4. Give XTA L1apositive pulse. Thisloads the data byte.
E. Latch Data
1. Set BS1to“1”.Thisselectshighdata byte.
2. Give PAGEL a positive pulse. Thislatches the data bytes. (See Figure 76 forsig-
nalwaveforms.)
F.Repeat B throughEuntil theentire buffer isfilled or until all data within the page is
loaded.
Whilethe lowerbits in theaddress aremapped to words within the page, the higherbits
address the pageswithin the Flash.This is illustrated in Figure 75onpage 182. Note
that ifless than eight bits are required to address words in the page (pagesize < 256),
themost significant bit(s) in theaddress lowbyte areused to address the page when
performing a page write.
G. Load Address Highbyte
1. Set XA1,XA0 to “00”. This enables address loading.
2. Set BS1to“1”.Thisselectshigh address.
3. Set DATA = Address highbyte ($00 -$FF).
4. Give XTA L1apositive pulse. Thisloads theaddress highbyte.
H.Program Page
1. Set BS1 = “0”.
2. Give WR
a negative pulse. Thisstartsprogramming of the entire page ofdata.
RDY/BSY
goeslow.
Comentarios a estos manuales