Special Function Registers
(SFR’s)
Special Function Registers (SFR’s)
• 21 Special function registers (SFR)
• There are 21 unique locations for these 21 special function
registers
• Each of these register is of 1 byte size.
seven groups
• 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 a data and receives the result of the arithmetic instructions.
• Follows direct addressing approach.
• physical address is from E0H to E7H.
• A Register 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 8-bit register.
• used for multiplication and division arithmetic operations.
• It is bit and byte-addressable register.
• It also follow direct addressing approach.
• Its physical address is from F0H to F7H
PSW (Program Status Word) Register:
• also called as Flag Register
• one of the important SFRs
• 8-bit register.
• consists of Flag Bits that reflect the current state of the CPU.
• both bit and byte addressable
• Consists of four conditional flags
• CY Carry
• AC Auxiliary Carry
• P parity
• OV overflow
Timer/Counter Registers:
• two 16-bit Programmable timers / counters (Timer 0 – Timer 1).
• Can be used as a timer – to generate time delay
• Or can be used as a counter to count events
• It has two special functions :
1. TMOD (Timer Mode Register)
2. TCON (Timer Control Register).
TMODE Registers:
• 8-bit register.
• Timer mode Register
• It consists of
• Gate
• C/T
• Mode selects
TCON Registers:
• Timer Control Register
• an 8-bit register.
• Consists of
• (0,1) TF TR IE IT
SP (Stack Pointer)
• Stack is a portion of RAM to store temporary datas.
• SP -stack pointer register is used to access the stack
• The Sp
• It is 8 bit register
• It can take values from 00 to FFH
• Explain push and pop
• Push – stroe CPU reg data
• POP – Pop/delete Cpu reg data
DP (Data pointer register):
• 16-bit register
• Used to store 16-bit address of data memory
• Can be used as two 8 bits DPH and DPL.
• Can be used as single 16bit register as DPTR
• 8 bit DP: Used to access internal RAM and SFR
• 16 bit DP : Used to access external data
Port Registers:
• 4 bidirectional I/O ports.
• Port 0, Port 1, Port 2 and Port 3 (P0, P1, P2 and P3)
• work as input or output port.
• Ports consists of Latches , Input buffer and output drivers
PC (program Counter):
• 16-bit register.
• use to hold the address of the memory location from where the next
instruction to be fetched.