118
ATmega161(L)
1228B–09/01
B. Load Address Low Byte
1.
Set XA1, XA0 to “00”. This enables address loading.
2.
Set BS1 to “0”. This selects low address.
3.
Set DATA = Address low byte ($00 - $FF).
4.
Give XTAL1 a positive pulse. This loads the address low byte.
C. Load Data Low Byte
1.
Set BS1 to “0”. This selects low data byte.
2.
Set XA1, XA0 to “01”. This enables data loading.
3.
Set DATA = Data low byte ($00 - $FF).
4.
Give XTAL1 a positive pulse. This loads the data byte.
D. Latch Data Low Byte
Give PAGEL a positive pulse. This latches the data low byte.
(See Figure 77 for signal waveforms.)
E. Load Data High Byte
1.
Set BS1 to “1”. This selects high data byte.
2.
Set XA1, XA0 to “01”. This enables data loading.
3.
Set DATA = Data high byte ($00 - $FF).
4.
Give XTAL1 a positive pulse. This loads the data byte.
F. Latch Data High Byte
Give PAGEL a positive pulse. This latches the data high byte.
G. Repeat “B” through “F” 64 times to fill the page buffer.
To address a page in the Flash, seven bits are needed (128 pages). The five most sig-
nificant bits are read from address high byte as described in section “H” below. The two
least significant page address bits, however, are the two most significant bits (bit7 and
bit6) of the latest loaded address low byte as described in section “B”.
H. Load Address High byte
1.
Set XA1, XA0 to “00”. This enables address loading.
2.
Set BS1 to “1”. This selects high address.
3.
Set DATA = Address high byte ($00 - $1F).
4.
Give XTAL1 a positive pulse. This loads the address high byte.
I. Program Page
1.
Give WR a negative pulse. This starts programming of the entire page of data.
RDY/BSYgoes low.
2.
Wait until RDY/BSY goes high.
(See Figure 78 for signal waveforms.)
J. End Page Programming
1.
Set XA1, XA0 to “10”. This enables command loading.
2.
Set DATA to “0000 0000”. This is the command for No Operation.
3.
Give XTAL1 a positive pulse. This loads the command, and the internal write sig-
nals are reset.
K. Repeat “A” through “J” 128 times or until all data have been programmed.