21.08.2013 Views

AVR Instruction Set Nomenclature: Status Register (SREG ...

AVR Instruction Set Nomenclature: Status Register (SREG ...

AVR Instruction Set Nomenclature: Status Register (SREG ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example:<br />

; This example shows ESPM write of one word for devices with page write<br />

clr r31 ; Clear Z high byte<br />

clr r30 ; Clear Z low byte<br />

ldi r16,$F0 ; Load RAMPZ register<br />

out RAMPZ, r16 ;<br />

ldi r16, $CF ; Load data to store<br />

mov r1, r16<br />

ldi r16, $FF<br />

mov r0, r16<br />

ldi r16,$03 ; Enable ESPM, erase page<br />

out SPMCR, r16 ;<br />

espm ; Erase page starting at $F00000<br />

ldi r16,$01 ; Enable ESPM, store R1:R0 to temporary buffer<br />

out SPMCR, r16 ;<br />

espm ; Execute ESPM, store R1:R0 to temporary buffer location $F00000<br />

ldi r16,$05 ; Enable ESPM, write page<br />

out SPMCR, r16 ;<br />

espm ; Execute SPM, store temporary buffer to program memory page starting at $F00000<br />

Words: 1 (2 bytes)<br />

Cycles: depends on the operation<br />

62<br />

<strong>Instruction</strong> <strong>Set</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!