Search This Blog

Monday, November 14, 2011

SFR (Special function registers) and their addresses

Registers R0-R7 are part of 128 bytes of RAM in microcontroller. Similarly registers A, B, PSW and DPTR are part of group of register known as SFR(special function registers) they have their own addresses too. They are usually accessed by their name as it is much easier. For example register A has address E0h B has F0h and so on.
See the examples.
MOV  0E0H, #55H; is same as
MOV A, #55H; which means load 55H into A

2 points need to be kept in mind.
  1. First special function register have their addres between 80h to FFh. These addresses are above 80h as addresses 00h to 7Fh are addresses of RAM memory inside 8051.
  2. Second, not all addresses between 80h to FFh are used by SFR. The unused location should not be used by a programmer.

Below * means bit addressable
Special function register addresses
Symbol
Name
Address
ACC*
Accumulator
0E0h
B*
Register B
0F0h
PSW*
Program Status word
0D0h
SP
Stack Pointer
81h
DPTR
Data pointer  2 bytes

DPL
Low byte
82h
DPH
High byte
83h
P0*
Port 0
80h
P1*
Port 1
90h
P2*
Port 2
0A0h
P3*
Port 3
0B0h
IP*
Interrupt priority control
0B8h
IE*
Interrupt enable control
0A8h
TMOD
Timer/counter mode control
89h
TCON
Timer/counter control
88h
T2CON
Timer/counter 2 control
0C8h
T2MOD
Timer/counter 2  mode control
0C9h
TH0
Timer/counter 0 high byte
8Ch
TL0
Timer/counter 0 low byte
8Ah
TH1
Timer/counter 1 high byte
8Dh
TL1
Timer/counter 1 low byte
8Bh
TH2
Timer/counter 2 high byte
0CDh
TL2
Timer/counter 2 low byte
0CCh
RCAP2H
T/C 2 capture register high byte
0CBh
RCAP2L
T/C 2 capture register low byte
0CAh
SCON*
Serial control
98h
SBUF
Serial data buffer
99h
PCON
Power control
87h


No comments:

Post a Comment