The Microcontroller 8051 Family
Features of 8051 Microcontroller
Pin Configuration of 8051 Microcontroller
Ports of 8051 Microcontroller
Architecture of 8051 Microcontroller
Registers of 8051
Special Function Registers (SFR's)
Bit addressable RAM
Register Bank and Stack of 8051
1. Introduction to 8051 Microcontroller
Dr. Nilesh Bhaskarrao Bahadure
nbahadure@gmail.com
https://www.sites.google.com/site/nileshbbahadure/home
July 25, 2021
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 1 / 33
2. Overview I
1 The Microcontroller 8051 Family
2 Features of 8051 Microcontroller
3 Pin Configuration of 8051 Microcontroller
4 Ports of 8051 Microcontroller
Port P0
Port P1
Port P2
Port P3
5 Architecture of 8051 Microcontroller
Arithmetic and Logic Unit (ALU)
Boolean Processor
Data and Program memory
Timing and control unit
Register structure of 8051 Microcontroller
6 Registers of 8051
Register Model of 8051 Microcontroller
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 2 / 33
3. Overview II
Flag register (PSW) of 8051
7 Special Function Registers (SFR’s)
8 Bit addressable RAM
9 Register Bank and Stack of 8051
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 3 / 33
4. The Microcontroller 8051 Family
The microcontroller system 8051 is an 8 - bit microcontroller. The families
members belong to the 8051 microcontrollers are also 8 - bit
microcontroller. These microcontrollers are fabricated by using HMOS /
NMOS technology. The CHMOS version of the microcontroller is also
available, CHMOS version is architecturally and functionally similar to
their counterpart fabricated using HMOS technology. The only difference
is that CHMOS version is having additional features like power down and
idle mode. In ideal mode the system is ON without consuming power.
They also have better speed, low power consumption, high noise immunity
compared to HMOS technology. Microcontroller 8051 core is available in
many variations. Table 1 shows some of the microcontroller 8051 family
members with the number of pins, size of data RAM, size of program
ROM, number of timers/counters, number of serial port and number of
interrupt sources available. The numbering convention system used for the
microcontroller 8051 family is shown in the figure 1 Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 4 / 33
5. Table : Comparisons of microcontroller 8051 and its family
Device Pins RAM
in
Bytes
ROM Timers/
Coun-
ters
I/O
Port
Serial
Ports
Interrupt
Sources
8031 40 128 0 kb 2 32 1 6
8032 40 256 0 kb 3 32 1 6
8051 40 128 4 kb
ROM
2 32 1 6
8052 40 256 8 kb
ROM
3 32 1 8
8054 40 256 16 kb
ROM
3 32 1 8
8751 40 128 4 kb
EPROM
2 32 1 6
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 5 / 33
6. Device Pins RAM
in
Bytes
ROM Timers/
Coun-
ters
I/O
Port
Serial
Ports
Interrup
Sources
8754 40 256 16 kb
EPROM
3 32 1 8
AT89C51 40 128 4 kb
Flash
ROM
2 32 1 6
AT89C52 40 256 8 kb
Flash
ROM
3 32 1 8
C1051 20 64 1 kb
Flash
ROM
1 15 – 6
C2051 20 128 2 kb
Flash
2 15 1 6
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 6 / 33
7. Device Pins RAM
in
Bytes
ROM Timers/
Coun-
ters
I/O
Port
Serial
Ports
Interrup
Sources
C4051 20 128 4 kb
Flash
ROM
2 15 1 6
C51RD2 40 256 8 kb
Flash
ROM
3 32 1 8
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 7 / 33
8. Figure : Numbering convention system use for the microcontroller 8051 family
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 8 / 33
9. Features of 8051 Microcontroller
1 It is a 40 pin IC fabricated using HMOS technology
2 It is also available in CHMOS versions.
3 It is an 8 bit microcontroller and belongs to family of 8 bit
microcontrollers.
4 It consists of 128 bytes on chip data memory (RAM) and 4 K bytes
on chip program memory (ROM)
5 It also consists 2 16 bit timers, 32 I/O lines and 6 interrupt sources.
6 The 32 I/O lines is organized into 4 8 bit parallel ports P0, P1, P2
and P3.
7 Using 16 address lines it is also able to handle 64 KB data memory
(RAM) or 64 KB program memory (ROM) externally (Off Chip)
8 It also consist standard UART, Universal Asynchronous Receiver
Transmitter
9 Operate at 12 MHz frequency (11.0592 MHz).
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 9 / 33
10. Pin Configuration of 8051 Microcontroller
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 10 / 33
11. Reset Operation of 8051 Microcontroller
Figure : Reset circuit 8051
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 11 / 33
12. Port P0
Port P0 Consists of 8 Pins - P0.0 to P0.7 making them as an 8 bit port.
P0 is configured as an I/O Port.
To access Port 0 Pins as an I/O Port external 10K “Pull Up Resistor”
must be connected with them because P0 pins are an open drain.
Open Drain is a terminology used for “MOS” technology and is similar as
an Open Collector used in the TTL technology.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 12 / 33
13. Dual Role of Port P0
As seen in the Pin Configuration with P0, address and data lines is also
used which indicates the dual role of Port P0.
If P0 is not used as an I/O Port, than it may be serve as to provide lower
order Address line A7-A0 or Data Lines D7-D0.
The status of ALE decides whether it is an address or data .
If ALE =1 , than the address lines are accessed else data lines.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 13 / 33
14. Port P1
Port P1 consists of 8 pins P1.0 to P1.7 making them as an 8 bit Port.
Port P1 is configured as an I/O Port.
Like Port P0, Port P1 doesnt need any Pull Up resistor, since they have
already pull up resistor internally.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 14 / 33
15. Port P2
Like Port P1, Port P2 also doesn’t need any pull up resistor, since they
have pull up resistor internally.
Port P2 consists of 8 pins P2.0 to P2.7 making them as an 8 bit Port.
Port P2 is configured as an I/O Port.
But there is a dual role of Port P2. As seen from the Pin Configuration,
Port P2 Pins also serve as a higher order address A8-A15.
8051 microcontroller is capable to address up to 64KB external memory,
to access 64KB memory requires 16 address line. Port P0 will provide
lower order address line A7-A0 of 16 address lines A15-A0.
Now, this is the job of Port P2 to provide remaining 8 address line .i.e.
higher order address lines A15-A8 and this indicates the dual role of Port
P2.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 15 / 33
16. Port P3
Like Port P1 and P2, P3 also doesn’t need any pull up resistor since they
have pull up resistor already internally.
Port P3 consists of 8 pins P3.0 to P3.7 making them as an 8 bit Port.
Port P3 is configured as an I/O Port, but this is not we employed Port P3
because Port P3 is used to provide some important and special functions
for 8051 which includes interrupts, serial communications, timers etc.
There is a dual role of Port P3 for which we use the above port. The table
list is given below which will display the role and functionality of each pin
of the above Port P3.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 16 / 33
17. Dual Role of Port P3
Port P3 Pins Pin Number Dual Configuration
P3.0 10 RXD
P3.1 11 TXD
P3.2 12 INT0
P3.3 13 INT1
P3.4 14 T0
P3.5 15 T1
P3.6 16 WR
P3.7 17 RD
Table : dual role of port p3
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 17 / 33
18. Architecture of 8051 Microcontroller
Figure : Block diagram of 8051
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 18 / 33
19. Architecture of 8051 Microcontroller....
The functional block diagram of 8 bit microcontroller is shown in the figure
4, the architecture of 8051 is broadly classified into the blocks given below
1 Arithmetic and Logic Unit (ALU)
2 Timing and Control Unit
3 RAM / ROM memory
4 Registers
5 Drivers and Latches for the ports P0, P1, P2 and P3
6 Arithmetic and Logic Unit (ALU)
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 19 / 33
20. Arithmetic and Logic Unit (ALU)
All the arithmetic and logical operations on the 8 - bit operand is
performed using ALU unit. After execution of any arithmetic and logical
operation, the result is automatically transferred to accumulator register
with few exceptions.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 20 / 33
21. Boolean Processor
In the 8051 microcontroller, inbuilt Boolean processor is available. In other
words, Boolean processor is integrated on the chip. Boolean processor
consists of their own instruction set, registers and bit addressable memory.
The carry flag serve as accumulator for the Boolean processor. Some of
the instructions of Boolean processor include set bit, clear bit and
complement bit etc.
Jump instruction or branching instruction is also supported by Boolean
processor.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 21 / 33
22. Data and Program memory
There is 128 bytes ON chip RAM memory available, apart from this there
is an additional 128 byte RAM memory is also available addresses from
80h to FFh referred as special function register (SFR’s). Microcontroller
8051 consist 16 address lines, so it is capable to access OFF chip 64 KB
data / program memory. There is a 16 bit register called DPTR used to
access the contents from OFF chip memory.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 22 / 33
23. Timing and control unit
All the operations in the 8051 microcontroller is always synchronous with
the timing and control unit. The timing and control unit is also having
signals like ALE, PSEN, RD, WR, RST and EA.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 23 / 33
24. Register structure of 8051 Microcontroller
In the CPU registers was used to load the information temporary. In the
8051 microcontroller large numbers of CPU registers are available and
they are broadly classified as:
1 General purpose registers or working registers,
2 stack pointer register,
3 program counter register and
4 DPTR (Data pointer register)
Along with this, there is a separate special function register is also
available. The most widely used general purpose registers are A
(Accumulator), B, R0, R1, R2, R3, R4, R5, R6, R7, PC and DPTR. All of
this registers are 8 bit wide except PC and DPTR which are 16 bit
registers.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 24 / 33
25. Register Model of 8051 Microcontroller
Figure : Register Model of 8051
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 25 / 33
26. Flag Register of 8051
Figure : Flag register of 8051
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 26 / 33
27. Special Function Registers (SFR’s)
SFR Symbol Name of the Register Address(Hex)
A* Accumulator 0E0h
B* Register - B 0F0h
PSW* Program Status Word 0D0h
SP Stack Pointer 81h
DPTR Data Pointer –
DPL(Data Pointer Lower Byte) 82h
DPH (Data Pointer Higher Byte) 83h
P0* Port 0 80h
P1* Port 1 90h
P2* Port 2 0A0h
P3* Port 3 0B0h
Table : Special Function Register’s and their addresses
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 27 / 33
28. Special Function Registers (SFR’s)
SFR Symbol Name of the Register Address(Hex)
IE* Interrupt Enable 0A8h
IP* Interrupt Priority 0B8h
PCON Power Control 87h
TCON* Timer Control 88h
TMOD Timer Mode 89h
TL0 Timer Zero Lower Byte 8Ah
TH0 Timer Zero Higher Byte 8Ch
TL1 Timer One Lower Byte 8Bh
TH1 Timer One Higher Byte 8Dh
SCON* Serial Control 98h
SBUF Serial Buffer 99h
Table : Special Function Register’s and their addresses....
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 28 / 33
29. Special Function Registers (SFR’s)...
Figure : Mapping of Internal RAM
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 29 / 33
30. Special Function Registers (SFR’s)...
Figure : Mapping of Internal SFR
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 30 / 33
31. Bit addressable RAM
Figure : Bit Addressable RAM
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 31 / 33
32. Register Bank and Stack of 8051
Figure : Internal (ON Chip) RAM of 128 Bytes
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 32 / 33
33. Thank you
Please send your feedback at nbahadure@gmail.com
For more details and updates kindly visit
https://sites.google.com/site/nileshbbahadure/home
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - I (Part I) July 25, 2021 33 / 33