EasyManua.ls Logo

Atmel AVR

Atmel AVR
191 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
117. SPM #2 – Store Program Memory
117.1. Description
SPM can be used to erase a page in the Program memory and to write a page in the Program memory
(that is already erased). An entire page can be programmed simultaneously after first filling a temporary
page buffer. The Program memory must be erased one page at a time. When erasing the Program
memory, the RAMPZ and Z-register are used as page address. When writing the Program memory, the
RAMPZ and Z-register are used as page or word address, and the R1:R0 register pair is used as data
(1)
.
Refer to the device documentation for detailed description of SPM usage. This instruction can address
the entire Program memory.
Note:  1. R1 determines the instruction high byte, and R0 determines the instruction low byte.
Operation:
(i) (RAMPZ:Z) ← $ffff Erase Program memory page
(ii) (RAMPZ:Z) ← R1:R0 Load Page Buffer
(iii) (RAMPZ:Z) ←
BUFFER
Write Page Buffer to Program memory
(iv) (RAMPZ:Z) ← $fff, Z
← Z + 2
Erase Program memory page, Z post
incremented
(v) BLBITS ← R1:R0, Z
← Z + 2
Load Page Buffer, Z post incremented
(vi) (RAMPZ:Z)
←BUFFER, Z ← Z +
2
Write Page Buffer to Program memory, Z
post incremented
Syntax: Operands: Program Counter:
(i)-(iii) SPM None PC ← PC + 1
(iv)-(vi) SPM Z+ None PC ← PC + 1
16-bit Opcode:
(i)-(iii) 1001 0101 1110 1000
(iv)-(vi) 1001 0101 1111 1000
117.2. Status Register (SREG) and Boolean Formula
I T H S V N Z C
Words 1 (2 bytes)
Atmel AVR Instruction Set Manual [OTHER]
Atmel-0856L-AVR-Instruction-Set-Manual_Other-11/2016
171

Table of Contents

Related product manuals