Datasheet

174
8246B–AVR–09/11
ATtiny2313A/4313
Since the Flash is organized in pages (see Table 21-1 on page 184), the Program Counter can
be treated as having two different sections. One section, consisting of the least significant bits, is
addressing the words within a page, while the most significant bits are addressing the pages.
This is shown in Figure 19-1, below.
Figure 19-1. Addressing the Flash During SPM
Variables used in Figure 19-1 are explained in Table 19-1, below.
Note that the Page Erase and Page Write operations are addressed independently. Therefore it
is of major importance that the software addresses the same page in both the Page Erase and
Page Write operation.
Table 19-1. Variables Used in Flash Addressing
Variable Description
PCPAGE
Program Counter page address. Selects page of words and is used with Page
Erase and Page Write operations. See Table 21-1 on page 184
PCMSB The most significant bit of the Program Counter. See Table 21-1 on page 184
ZPCMSB
The bit in the Z register that is mapped to PCMSB. Because Z[0] is not used,
ZPCMSB = PCMSB + 1. Z register bits above ZPCMSB are ignored
PCWORD
Program Counter word address. Selects the word within a page. This is used
for filling the temporary buffer and must be zero during page write operations.
See Table 21-1 on page 184
PAGEMSB The most significant bit used to address the word within one page
ZPAGEMSB
The bit in the Z register that is mapped to PAGEMSB. Because Z[0] is not used,
ZPAGEMSB = PAGEMSB + 1
PROGRAM MEMORY
0115
Z - REGISTER
BIT
0
ZPAGEMSB
WORD ADDRESS
WITHIN A PAGE
PAGE ADDRESS
WITHIN THE FLASH
ZPCMSB
INSTRUCTION WORD
PAG E
PCWORD[PAGEMSB:0]:
00
01
02
PAGEEND
PAG E
PCWORDPCPAGE
PCMSB
PAGEMSB
PROGRAM
COUNTER