UMBC CMSC 391 -- Programming Microcontrollers  


Internal RAM

Byte AddressNameFunction
Register bank 0 -- Default register bank on reset
00 R0  
01 R1  
02 R2  
03 R3  
04 R4  
05 R5  
06 R6  
07 R7 SP is set to 07h on reset
Register bank 1
08 R0  
09 R1  
0A R2  
0B R3  
0C R4  
0D R5  
0E R6  
0F R7  
Register bank 2
10 R0  
11 R1  
12 R2  
13 R3  
14 R4  
15 R5  
16 R6  
17 R7  
Register bank 3
18 R0  
19 R1  
1A R2  
1B R3  
1C R4  
1D R5  
1E R6  
1F R7  

Bit-addressable RAM -- May be addressed as entire bytes, or may be addressed as shown
Byte AddressBit
 7  6  5  4  3  2  1  0 
20 07 06 05 04 03 02 01 00
21 0F 0E 0D 0C 0B 0A 09 08
22 17 16 15 14 13 12 11 10
23 1F 1E 1D 1C 1B 1A 19 18
24 27 26 25 24 23 22 21 20
25 2F 2E 2D 2C 2B 2A 29 28
26 37 36 35 34 33 32 31 30
27 3F 3E 3D 3C 3B 3A 39 28
28 47 46 45 44 43 42 41 40
29 4F 4E 4D 4C 4B 4A 49 48
2A 57 56 55 54 53 52 51 50
2B 5F 5E 5D 5C 5B 5A 59 58
2C 67 66 65 64 63 62 61 60
2D 6F 6E 6D 6C 6B 6A 69 68
2E 77 76 75 74 73 72 71 70
2F 7F 7E 7D 7C 7B 7A 79 79

Note that the following bit mnemonics are used when addressing bit:
  ANL  C,b
CPL b
CLR b
JB b,radd
JBC b,radd
JNB b,radd
MOV c,b
MOV b,C
ORL C,b
SETB b

Byte AddressName
30-7FGeneral Purpose RAM

Byte
Address
Bit
 7  6  5  4  3  2  1  0 
NameFunctionContents
on reset
80
 87 86 85 84 83 82 81 80 
P07-P0.0 Port 0 pins 7-0 0FFH
81   SP Stack Pointer 07H
82   DPL Data Pointer low byte 00H
83   DPH Data Pointer high byte 00H
87   PCON Power Mode Control SFR 00H
88
 8F 8E 8D 8C 8B 8A 89 88 
TCON Timer Control SFR 00H
89   TMOD Timer Mode Control SFR 00H
8A   TL0 Timer 0 low byte 00H
8B   TL1 Timer 1 low byte 00H
8C   TH0 Timer 0 high byte 00H
8D   TH1 Timer 1 high byte 00H
90
 97 96 95 94 93 92 91 90 
P1.7-P1.0 Port 1 pins 7-0 0FFH
98
 9F 8E 9D 9C 9B 9A 99 98 
SCON Serial Port Control SFR 00H
99   SBUF Serial Data Buffer xxH
A0
 A7 A6 65 A4 A3 A2 A1 A0 
P2.7-P2.0 Port 2 pins 7-0 0FFH
A8
 AF       AC AB AA A9 A8 
IE.7-IE.0 Interrupt Enable SFR 00H
B0 P3.7-P3.0 Port 3 pins 7-0 0FFH
B8
          BC BB BA B9 B8 
IP.7-IP.0 Interrupt Priority SFR 00H
D0
 D7 D6 D5 D4 D3 D2 D1 D0 
PSW.7-PSW.0 Program status word 00H
E0
 E7 E6 E5 E4 E3 E2 E1 E0 
ACC.7-ACC.0 Accumulator A 00H
F0
 F7 F6 F5 F4 F3 F2 F1 F0 
B.7-B.0 B Register 00H

Comments

Missing addresses

Address that are not listed in the table do not exist. Attempting to write to them might cause difficulties if you are using a variant of the 8051 that actually implements that specific address.

Byte Address/Bit Address

bytes addresses are also the bit address of bit 0 for the byte. For example, Port 0 byte address is 080H. Bit 0 of Port 0 is also addressed as 080H. Opcodes used for bit operations, however, are unique.

Multiple Names

The SFR addressable bits may be addressed using absolute hex addresses, by SFR.bit names, or by functional names that are shown for each bit of the control registers. For example, bit 7 of ite IE SFR may be addressed at hex address 0AFH, by the SFR bit name of IE.7, or by the functional name EA. The resulting code may not necessarily be the same nor the same number of bytes.


©2004, Gary L. Burt