Sram data memory, Atmega161(l) – Rainbow Electronics ATmega161L User Manual

Page 12

Advertising
background image

12

ATmega161(L)

1228C–AVR–08/02

SRAM Data Memory

Figure 8 shows how the ATmega161 SRAM memory is organized.

Figure 8. SRAM Organization

The lower 1120 Data memory locations address the Register File, the I/O memory and
the internal data SRAM. The first 96 locations address the Register File and I/O memory
and the next 1K locations address the internal data SRAM. An optional external Data
memory device can be placed in the same SRAM memory space. This memory device
will occupy the locations following the internal SRAM and up to as much as 64K - 1,
depending on external memory size.

When the addresses accessing the Data memory space exceed the internal data SRAM
locations, the memory device is accessed using the same instructions as for the internal
data SRAM access. When the internal data space is accessed, the read and write
strobe pins (RD and WR) are inactive during the whole access cycle. External memory
operation is enabled by setting the SRE bit in the MCUCR Register. See “Interface to
External Memory” on page 84
for details.

Accessing external memory takes one additional clock cycle per byte compared to
access of the internal SRAM. This means that the commands LD, ST, LDS, STS,
PUSH, and POP take one additional clock cycle. If the Stack is placed in external mem-
ory, interrupts, subroutine calls and returns take two clock cycles extra because the 2-
byte Program Counter is pushed and popped. When external memory interface is used
with wait state, two additional clock cycles are used per byte. This has the following
effect: Data transfer instructions take two extra clock cycles, whereas interrupt, subrou-
tine calls and returns will need four clock cycles more than specified in the Instruction
Set manual.

Register File

Data Address Space

R0

$0000

R1

$0001

R2

$0002

R29

$001D

R30

$001E

R31

$001F

I/O Registers

$00

$0020

$01

$0021

$02

$0022

$3D

$005D

$3E

$005E

$3F

$005F

Internal SRAM

$0060

$0061

$045E

$045F

Advertising