attiny167-esxz ATMEL Corporation, attiny167-esxz Datasheet - Page 209

no-image

attiny167-esxz

Manufacturer Part Number
attiny167-esxz
Description
8-bit Avr 8-bit Microcontroller Microcontroller With 16k Bytes In-system Programmable Flash And Lin Controller
Manufacturer
ATMEL Corporation
Datasheet
20.1.3
20.2
7728A–AUTO–07/08
Addressing the Flash During Self-Programming
Performing a Page Write
To execute Page Write, set up the address in the Z-pointer, write “00000101
execute SPM within four clock cycles after writing SPMCSR. The data in R1 and R0 is ignored.
The page address must be written to PCPAGE. Other bits in the Z-pointer must be written to
zero during this operation.
The Z-pointer is used to address the SPM commands. The Z pointer consists of the Z-registers
ZL and ZH in the register file. The number of bits actually used is implementation dependent.
Since the Flash is organized in pages (see
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
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.
The LPM instruction uses the Z-pointer to store the address. Since this instruction addresses the
Flash byte-by-byte, also the LSB (bit Z0) of the Z-pointer is used.
Figure 20-1. Addressing the Flash During SPM
Note:
Bit
Bit
The CPU is halted during the Page Write operation.
1. The different variables used in
PROGRAM COUNTER
BIT
PROGRAM MEMORY
15
Z15
15
Z7
7
PAGE
Figure
PAGE ADDRESS
WITHIN THE FLASH
Z14
14
Z6
6
ZPCMSB
20-1.
PCMSB
PCPAGE
Z13
13
Z5
5
Table 20-2
Z12
12
Z4
4
ZPAGEMSB
PAGEMSB
Table 21-7 on page
PCWORD
WORD ADDRESS
WITHIN A PAGE
(1)
are listed in
Z11
11
Z3
3
1
0
0
INSTRUCTION WORD
Z - POINTER
Z10
10
Z2
2
Table 21-7 on page
PAGE
219), the Program Counter can
Z9
Z1
9
1
PCWORD[PAGEMSB:0]:
00
01
02
PAGEEND
ATtiny167
b
” to SPMCSR and
Z8
Z0
8
0
219.
ZH (R31)
ZL (R30)
209

Related parts for attiny167-esxz