8. Data Memory
The AT89C5132 provides data memory access in two different spaces:
1. The internal space mapped in three separate segments:
–
–
–
The lower 128 Bytes RAM segment
The upper 128 Bytes RAM segment
The expanded 2048 Bytes RAM segment
2. The external space.
A fourth internal segment is available but dedicated to Special Function Registers, SFRs,
(addresses 80h to FFh) accessible by direct addressing mode. For information on this segment,
refer to the section “Special Function Registers”, page 29.
Figure 8-1 shows the internal and external data memory spaces organization.
Figure 8-1. Internal and External Data Memory Organization
FFFFh
64K Bytes
External XRAM
7FFh
FFh
FFh
80h
Upper
128 Bytes
Internal RAM
indirect addressing
Special
Function
Registers
direct addressing
2K Bytes
Internal ERAM
EXTRAM = 0
80h
7Fh
Lower
128 Bytes
Internal RAM
direct or indirect
addressing
0800h
0000h
EXTRAM = 1
00h
00h
8.1
Internal Space
8.1.1
Lower 128 Bytes RAM
The lower 128 Bytes of RAM (see Figure 8-2) are accessible from address 00h to 7Fh using
direct or indirect addressing modes. The lowest 32 Bytes are grouped into 4 banks of 8 registers
(R0 to R7). Two Bits RS0 and RS1 in PSW register (see Table 13) select which bank is in use
according to Table 10. This allows more efficient use of code space, since register instructions
are shorter than instructions that use direct addressing, and can be used for context switching in
interrupt service routines.
Table 10. Register Bank Selection
RS1
RS0
Description
0
0
1
1
0
1
0
1
Register bank 0 from 00h to 07h
Register bank 1 from 08h to 0Fh
Register bank 2 from 10h to 17h
Register bank 3 from 18h to 1Fh
22
AT89C5132
4173E–USB–09/07