Program And Data Addressing Modes - Atmel AVR ATmega103 Manual

8-bit microcontroller with 128k bytes in-system programmable flash
Table of Contents

Advertisement

Program and Data
Addressing Modes
ATmega103(L)
12
The 4096 first data memory locations address both 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 4000 locations address the internal data SRAM.
An optional external data SRAM can be used with the ATmega103(L). This SRAM will
occupy an area in the remaining address locations in the 64K address space. This area
starts at the address following the internal SRAM. If a 64K external SRAM is used, 4K of
the external memory is lost as the addresses are occupied by internal memory.
When the addresses accessing the SRAM memory space exceeds the internal data
memory locations, the external data SRAM is accessed using the same instructions as
for the internal data memory access. When the internal data memories are accessed,
the read and write strobe pins (RD and WR) are inactive during the whole access cycle.
External SRAM operation is enabled by setting the SRE bit in the MCUCR register.
Accessing external SRAM 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 SRAM, interrupts,
subroutine calls and returns take two clock cycles extra because the 2-byte program
counter is pushed and popped. When external SRAM 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, subroutine calls and returns
will need four clock cycles more than specified in the "Instruction Set Summary" on page
130.
The five different addressing modes for the data memory cover: Direct, Indirect with Dis-
placement, Indirect, Indirect with Pre-decrement and Indirect with Post-increment. In the
register file, registers R26 to R31 feature the indirect addressing pointer registers.
The Indirect with Displacement mode features 63 address locations reached from the
base address given by the Y- or Z-register.
When using register indirect addressing modes with automatic pre-decrement and post-
increment, the address registers X, Y, and Z are decremented and incremented.
The entire data address space including the 32 general-purpose working registers and
the 64 I/O registers are all accessible through all these addressing modes. See the next
section for a detailed description of the different addressing modes.
The ATmega103(L) AVR RISC microcontroller supports powerful and efficient address-
ing modes for access to the program memory (Flash) and data memory (SRAM, register
file and I/O memory). This section describes the different addressing modes supported
by the AVR architecture. In the figures, OP means the operation code part of the instruc-
tion word. To simplify, not all figures show the exact location of the addressing bits.
0945G–09/01

Advertisement

Table of Contents
loading

This manual is also suitable for:

Avr atmega103l

Table of Contents