Rainbow-electronics ATmega161L Manual de usuario Pagina 114

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 159
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 113
114
ATmega161(L)
1228CAVR08/02
Store Program Memory
Control Register SPMCR
The Store Program Memory Control Register contains the control bits needed to control
the programming of the Flash from internal code execution.
Bits 7..4
Res: Reserved Bits
These bits are reserved bits in the ATmega161 and always read as zero.
Bit 3
BLBSET: Boot Lock Bit Set
If this bit is set at the same time as SPMEN, the next SPM instruction within four clock
cycles sets Boot Lock bits according to the data in R0. The data in R1 and the address
in the Z-pointer are ignored. The BLBSET bit will auto-clear upon completion of Lock bit
set, or if no SPM instruction is executed within four clock cycles. The CPU is halted dur-
ing Lock bit setting. Only a chip erase can clear the Lock bits.
An LPM instruction within four cycles after BLBSET and SPMEN are set in the SPMCR
Register will put either the Lock bits or the Fuse bits (depending od the Z0 in the Z-
pointer) into the destination register. See Reading the Fuse and Lock bits from Soft-
warefor details.
Bit 2
PGWRT: Page Write
If this bit is set at the same time as SPMEN, the next SPM instruction within four clock
cycles executes page write, with the data stored in the temporary buffer. The page
address is taken from the high part of the Z-pointer. The data in R1 and R0 are ignored.
The PGWRT bit will auto-clear upon completion of a page write or if no SPM instruction
is executed within four clock cycles. The CPU is halted during the entire page write
operation.
Bit 1
PGERS: Page Erase
If this bit is set at the same time as SPMEN, the next SPM instruction within four clock
cycles executes a page erase. The page address is taken from the high part of the Z-
pointer. The data in R1 and R0 are ignored. The PGERS bit will auto-clear upon comple-
tion of a page erase or if no SPM instruction is executed within four clock cycles. The
CPU is halted during the entire page erase operation.
Bit 0
SPMEN: Store Program Memory Enable
This bit enables the SPM instruction for the next four clock cycles. If set together with
either BLBSET, PGWRT or PGERS, the following SPM instruction will have a special
meaning (see description above). If only SPMEN is set, the following SPM instruction
will store the value in R1:R0 in the temporary page buffer addressed by the Z-pointer.
The LSB of the Z-pointer is ignored. The SPMEN bit will auto-clear upon completion of
an SPM instruction or if no SPM instruction is executed within four clock cycles.
Writing any combination other than 1001, 0101, 0011 or 0001 in the lower four
bits, or writing to the I/O Register when any bits are set, will have no effect.
Bit 76543210
$37 ($57) –– BLBSET PGWRT PGERS SPMEN SPMCR
Read/Write R R R R R/W R/W R/W R/W
InitialValue00000000
Vista de pagina 113
1 2 ... 109 110 111 112 113 114 115 116 117 118 119 ... 158 159

Comentarios a estos manuales

Sin comentarios