
167
ATmega8515(L)
2512A–AVR–04/02
• Bit1–PGERS:PageErase
If thisbit iswritten to one at the same time asSPMEN, thenext SPM instruction within
fourclock cycles executes Page Erase. The page address is taken from the highpartof
the Z-pointer.The data in R1 and R0 areignored.ThePGERSbit will auto-clear upon
completion of aPageErase, or if no SPM instruction is executedwithin fourclock
cycles.The CPU ishaltedduring the entire page write operation if the NRWW section is
addressed.
• Bit 0 – SPMEN: Store Program Memory Enable
Thisbit enables the SPM instruction for thenext fourclock cycles. If writtentoone
togetherwith either RWWSRE, BLBSET, PGWRT’ or PGERS, the following SPM
instruction will have a special meaning,see description above. If only SPMEN iswritten,
the following SPM instruction will storethevalue in R1:R0 in thetemporary page buffer
addressedbythe Z-pointer.The LSB of the Z-pointer is ignored.The SPMEN bit will
auto-clear upon completion of an SPM instruction, or if no SPM instruction is executed
within fourclock cycles. During Page Eraseand Page Write, the SPMEN bit remains
high until theoperation iscompleted.
Writing any othercombination than “10001”, “01001”, “00101”, “00011”, or “00001” in
the lowerfive bitswill havenoeffect.
Addressing the Flash
During Self-
Programming
The Z-pointer is used to address the SPMcommands.
Sincethe Flash is organized in pages(see Table89 on page 179), theProgram Counter
can betreated ashaving two different sections. One section,consisting of the least sig-
nificant bits, is addressing the words within a page,whilethemost significant bits are
addressing the pages.This isshowninFigure 73. Note that the Page Eraseand Page
Write operations areaddressed independently.Thereforeitis of major importancethat
the Boot Loadersoftwareaddresses the same page in both thePageEraseand Page
Write operation. Onceaprogramming operation is initiated, theaddress islatched and
the Z-pointercan beusedfor other operations.
Theonly SPM operation that does not usethe Z-pointer isSetting the Boot LoaderLock
bits.The content of the Z-pointer is ignored andwill havenoeffectontheoperation. The
LPM instruction does alsousethe Z-pointer to storetheaddress. Sincethis instruction
addresses the Flash byte by byte, alsothe LSB (bit Z0) of the Z-pointer is used.
Bit 15 14 13 12 11 10 9 8
ZH (R31) Z15 Z14 Z13 Z12 Z11 Z10 Z9 Z8
ZL (R30) Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0
76543 210
Comentários a estes Manuais