Page 79 - CITS - Electronic Mechanic - TT - 2024
P. 79
ELECTRONICS MECHANIC - CITS
Special Function Registers (SFR’s)
In 8051 micro controller there are 21 Special function registers (SFR), and this includes Register A, Register B,
Processor Status Word (PSW), PCON etc. There are 21 unique locations for these 21 special function registers
and each of these registers is of 1 byte size.
The 21 SFR of 8051 Microcontroller are categorized into seven groups these are:
Math or CPU Registers: A and B Register
Status Register: PSW (Program Status Word) Register
Pointer Registers: DPTR (Data Pointer – DPL, DPH) and SP (Stack Pointer) Registers
I/O Port Latches: P0 (Port 0), P1 (Port 1), P2 (Port 2) and P3 (Port 3) Registers
Peripheral Control Registers: PCON, SCON, TCON, TMOD, IE and IP Registers
Peripheral Data Registers: TL0, TH0, TL1, TH1 and SBUF Registers.
Accumulator (A register)
It is an 8-bit register.
It holds data and receives the result of the arithmetic instructions.
ACC is usually accessed by direct addressing and its physical address is E0H. The accumulator is both byte and
bit addressable. If you want to access the second bit (i.e. bit 1), you may use E1H and for third bit E2H and so
on.
B Register :
It is an 8-bit register.
It is a bit and byte-addressable register.
You can access 1-bit or all 8-bits by a physical address F0h. Supposed to access a bit 1, we must use f1.
The B register is only used for multiplication and division arithmetic operations.
PSW (Program Status Word) Register
The PSW (Program Status Word) Register is also called Flag Register. It is one of the important SFRs in 8051
microcontrollers. It is also an 8-bit register. It consists of Flag Bits or status bits that reflect the current state of the
CPU. This will help the programmer in checking the condition of the result and making decisions.
PSW flag register is both bit and byte addressable. The physical address of PSW starts from D0H. The individual
bits are accessed by using bit address D1, D2 … D7. The two unused bits are user-defined flags. Four of the
flags are called conditional flags, which means that they indicate a condition which results after an instruction is
executed. These four are CY (Carry), AC (auxiliary carry), P (parity), and OV (overflow).
64
CITS : E & H - Electronics Mechanic - Lesson 34 - 42