Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

ATMEGA161-4AI Datasheet(PDF) 98 Page - ATMEL Corporation

Part # ATMEGA161-4AI
Description  8-bit Microcontroller with 16K Bytes In-System Programmable Flash
PDF  134 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  ATMEL [ATMEL Corporation]
Direct Link  http://www.atmel.com
Logo ATMEL - ATMEL Corporation

ATMEGA161-4AI Datasheet(HTML) 98 Page - ATMEL Corporation

Back Button ATMEGA161-4AI Datasheet HTML 94Page - ATMEL Corporation ATMEGA161-4AI Datasheet HTML 95Page - ATMEL Corporation ATMEGA161-4AI Datasheet HTML 96Page - ATMEL Corporation ATMEGA161-4AI Datasheet HTML 97Page - ATMEL Corporation ATMEGA161-4AI Datasheet HTML 98Page - ATMEL Corporation ATMEGA161-4AI Datasheet HTML 99Page - ATMEL Corporation ATMEGA161-4AI Datasheet HTML 100Page - ATMEL Corporation ATMEGA161-4AI Datasheet HTML 101Page - ATMEL Corporation ATMEGA161-4AI Datasheet HTML 102Page - ATMEL Corporation Next Button
Zoom Inzoom in Zoom Outzoom out
 98 / 134 page
background image
ATmega161(L)
98
Addressing the FLASH During Self-programming
The Z pointer is used to address the SPM commands.
Z15:Z14 always ignored
Z13:Z7
page select, for page erase, page write
Z6:Z1
word select, for filling temp buffer (must be zero during page write operation)
Z0
should be zero for all SPM commands, byte select for the LPM instruction.
The only operation that does not use the Z pointer is Setting the Boot Loader Lock Bits. The content of the Z pointer is
ignored and will have no effect on the operation.
Note that the page erase and page write operation is addressed independently. Therefore it is of major importance that the
Boot Loader software addresses the same page in both the page erase and page write operation.
The LPM instruction does also use the Z pointer to store the address. Since this instruction does address the FLASH byte
by byte, also the LSB (bit Z0) of the Z pointer is used. See page 16 for a detailed description.
Accidental writing into Flash program by the SPM instruction is prevented by setting up a "SPM enable time window". All
accesses are executed by first setting I/O bits, and then executing SPM within four clock cycles. The I/O register that con-
trols the SPM accesses is defined as follows:
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.
• Bit 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 comple-
tion of lock bit set, or if no SPM instruction is executed within four clock cycles. The CPU is halted during 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 Software” on page 99 for 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 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 completion 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
15
14131211
10
9
8
$1F ($1F)
Z15
Z14
Z13
Z12
Z11
Z10
Z9
Z8
ZH
$1E ($1E)
Z7
Z6
Z5
Z4
Z3
Z2
Z1
Z0
ZL
76
543
210
Bit
7
6
543
210
$37 ($57)
-
-
BLBSET
PGWRT
PGERS
SPMEN
SPMCR
Read/Write
R
R
R
R
R/W
R/W
R/W
R/W
Initial value
0
0
0
0
0
0
0
0



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com