ATMEGA48A-PU Atmel, ATMEGA48A-PU Datasheet - Page 271
Manufacturer Part Number
IC MCU AVR 4K FLASH 28PDIP
Specifications of ATMEGA48A-PU
I²C, SPI, UART/USART
Brown-out Detect/Reset, POR, PWM, WDT
Number Of I /o
Program Memory Size
4KB (2K x 16)
Program Memory Type
256 x 8
512 x 8
Voltage - Supply (vcc/vdd)
1.8 V ~ 5.5 V
-40°C ~ 85°C
Package / Case
28-DIP (0.300", 7.62mm)
No. Of I/o's
Eeprom Memory Size
Ram Memory Size
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Addressing the Flash During Self-Programming
Performing a Page Write
SPMCSR. It is also erased after a system reset. Note that it is not possible to write more than
one time to each address without erasing the temporary buffer.
If the EEPROM is written in the middle of an SPM Page Load operation, all data loaded will be
To execute Page Write, set up the address in the Z-pointer, write “00000101” to SPMCSR and
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 CPU is halted during the Page Write operation.
The Z-pointer is used to address the SPM commands.
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
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 26-3 on page
284. Note that the Page Erase and Page Write operations
Table 27-11 on page
301), the Program Counter can