Skip to main content

8051 data memory organization

Short answer

Internal data RAM (00H–7FH) contains four register banks (00H–1FH), a bit-addressable area (20H–2FH) of 16 bytes, and 80 bytes general-purpose RAM (30H–7FH). SFRS occupy 80H–FFH; bit-addressable SFRS include ports, PSW, ACC, B. Exteranal data memory up to 64 KB is accessed via MOVX.

Explain the data memory organization in 8051 microcontroller.

The 8051 has 128 bytes of internal data RAM (addresses 00H-7FH) and a separate SFR area (80H-FFH). More data memory can be added externally (up to 64 KB, accessed by MOVX).

 FFH +-------------------------+
     | SFRs: P0,P1,P2,P3,TCON, |  direct addressing only
 80H | TMOD,IE,IP,PSW,ACC,B... |
 7FH +-------------------------+
     | General-purpose RAM     |  80 bytes
 30H |                         |
 2FH +-------------------------+
     | Bit-addressable RAM     |  16 bytes = 128 bits
 20H |                         |  bit addresses 00H-7FH
 1FH +-------------------------+
     | Register bank 3         |
 18H | Register bank 2         |
 10H | Register bank 1         |
 08H | Register bank 0 (R0-R7) |
 00H +-------------------------+
  1. Register banks (00H-1FH): four banks of R0-R7. The active bank is selected by the RS1 and RS0 bits of PSW; bank 0 is the default after reset.
  2. Bit-addressable area (20H-2FH): 16 bytes giving 128 individually addressable bits, used with SETB, CLR, CPL, JB, JNB.
  3. General-purpose RAM (30H-7FH): 80 bytes for variables and the stack. The stack pointer is 07H after reset, so the stack starts at 08H (overlapping banks 1-3 unless SP is changed).
  4. SFRs (80H-FFH): ports, timers, serial buffer, PSW, ACC, B, SP, DPTR. Those with addresses divisible by 8 (P0, TCON, P1, SCON, P2, IE, P3, IP, PSW, ACC, B) are bit-addressable.

The 8052 has another 128 bytes at 80H-FFH reachable only by indirect addressing.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Embedded System chapter 9 questions →