KEMBAR78
8051 Microcontroller | PDF | Microcontroller | Input/Output
0% found this document useful (0 votes)
108 views7 pages

8051 Microcontroller

The 8051 microcontroller, introduced by Intel in 1981, is an 8-bit system on a chip featuring 128 bytes of RAM, 4K bytes of ROM, and multiple I/O ports, timers, and interrupt sources. Variants include the 8052, which has more RAM and ROM, and the 8031, which is ROM-less and requires external memory. The 8051 family supports various configurations and has a robust interrupt system, enabling efficient task management.

Uploaded by

satish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views7 pages

8051 Microcontroller

The 8051 microcontroller, introduced by Intel in 1981, is an 8-bit system on a chip featuring 128 bytes of RAM, 4K bytes of ROM, and multiple I/O ports, timers, and interrupt sources. Variants include the 8052, which has more RAM and ROM, and the 8031, which is ROM-less and requires external memory. The 8051 family supports various configurations and has a robust interrupt system, enabling efficient task management.

Uploaded by

satish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

8051 Microcontroller

Brief History of 8051


The first microprocessor 4004 was invented by Intel
Corporation. 8085 and 8086 microprocessors were also invented by Intel. In 1981, Intel
introduced an 8-bit microcontroller called the 8051. It was referred as system on a
chip because it had 128 bytes of RAM, 4K byte of on-chip ROM, two timers, one serial
port, and 4 ports (8-bit wide), all on a single chip. When it became widely popular, Intel
allowed other manufacturers to make and market different flavors of 8051 with its code
compatible with 8051. It means that if you write your program for one flavor of 8051, it
will run on other flavors too, regardless of the manufacturer. This has led to several
versions with different speeds and amounts of on-chip RAM.

8051 Flavors / Members


 8052 microcontroller − 8052 has all the standard features of the 8051
microcontroller as well as an extra 128 bytes of RAM and an extra timer. It also
has 8K bytes of on-chip program ROM instead of 4K bytes.
 8031 microcontroller − It is another member of the 8051 family. This chip is
often referred to as a ROM-less 8051, since it has 0K byte of on-chip ROM. You
must add external ROM to it in order to use it, which contains the program to be
fetched and executed. This program can be as large as 64K bytes. But in the
process of adding external ROM to the 8031, it lost 2 ports out of 4 ports. To
solve this problem, we can add an external I/O to the 8031

Comparison between 8051 Family Members


The following table compares the features available in 8051, 8052, and 8031.

Feature 8051 8052 8031

ROM(bytes) 4K 8K 0K

RAM(bytes) 128 256 128

Timers 2 3 2

I/O pins 32 32 32

Serial port 1 1 1

Interrupt sources 6 8 6
Features of 8051 Microcontroller
An 8051 microcontroller comes bundled with the following features −

 4KB bytes on-chip program memory (ROM)


 128 bytes on-chip data memory (RAM)
 Four register banks
 128 user defined software flags
 8-bit bidirectional data bus
 16-bit unidirectional address bus
 32 general purpose registers each of 8-bit
 16 bit Timers (usually 2, but may have more or less)
 Three internal and two external Interrupts
 Four 8-bit ports,(short model have two 8-bit ports)
 16-bit program counter and data pointer
 8051 may also have a number of special features such as UARTs, ADC, Op-
amp, etc.

Block Diagram of 8051 Microcontroller


The following illustration shows the block diagram of an 8051 microcontroller −
Microcontrollers - 8051 Pin Description
The pin diagram of 8051 microcontroller looks as follows −

 Pins 1 to 8 − These pins are known as Port 1. This port doesn’t serve
any other functions. It is internally pulled up, bi-directional I/O port.
 Pin 9 − It is a RESET pin, which is used to reset the microcontroller to
its initial values.
 Pins 10 to 17 − These pins are known as Port 3. This port serves some
functions like interrupts, timer input, control signals, serial
communication signals RxD and TxD, etc.
 Pins 18 & 19 − These pins are used for interfacing an external crystal
to get the system clock.
 Pin 20 − This pin provides the power supply to the circuit.
 Pins 21 to 28 − These pins are known as Port 2. It serves as I/O port.
Higher order address bus signals are also multiplexed using this port.
 Pin 29 − This is PSEN pin which stands for Program Store Enable. It is
used to read a signal from the external program memory.
 Pin 30 − This is EA pin which stands for External Access input. It is
used to enable/disable the external memory interfacing.
 Pin 31 − This is ALE pin which stands for Address Latch Enable. It is
used to demultiplex the address-data signal of port.
 Pins 32 to 39 − These pins are known as Port 0. It serves as I/O port.
Lower order address and data bus signals are multiplexed using this
port.
 Pin 40 − This pin is used to provide power supply to the circuit.

Microcontrollers 8051 Input Output Ports

8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured as input
or output. Hence, total 32 input/output pins allow the microcontroller to be connected
with the peripheral devices.
 Pin configuration, i.e. the pin can be configured as 1 for input and 0 for output
as per the logic state.
o Input/Output (I/O) pin − All the circuits within the microcontroller must be
connected to one of its pins except P0 port because it does not have pull-
up resistors built-in.
o Input pin − Logic 1 is applied to a bit of the P register. The output FE
transistor is turned off and the other pin remains connected to the power
supply voltage over a pull-up resistor of high resistance.
 Port 0 − The P0 (zero) port is characterized by two functions −
o When the external memory is used then the lower address byte
(addresses A0A7) is applied on it, else all bits of this port are configured
as input/output.
o When P0 port is configured as an output then other ports consisting of
pins with built-in pull-up resistor connected by its end to 5V power supply,
the pins of this port have this resistor left out.

Input Configuration
If any pin of this port is configured as an input, then it acts as if it “floats”, i.e. the input
has unlimited input resistance and in-determined potential.
Output Configuration
When the pin is configured as an output, then it acts as an “open drain”. By applying
logic 0 to a port bit, the appropriate pin will be connected to ground (0V), and applying
logic 1, the external output will keep on “floating”.
In order to apply logic 1 (5V) on this output pin, it is necessary to build an external
pullup resistor.
Port 1
P1 is a true I/O port as it doesn’t have any alternative functions as in P0, but this port
can be configured as general I/O only. It has a built-in pull-up resistor and is completely
compatible with TTL circuits.
Port 2
P2 is similar to P0 when the external memory is used. Pins of this port occupy
addresses intended for the external memory chip. This port can be used for higher
address byte with addresses A8-A15. When no memory is added then this port can be
used as a general input/output port similar to Port 1.
Port 3
In this port, functions are similar to other ports except that the logic 1 must be applied
to appropriate bit of the P3 register.

Pins Current Limitations


 When pins are configured as an output (i.e. logic 0), then the single port pins can
receive a current of 10mA.
 When these pins are configured as inputs (i.e. logic 1), then built-in pull-up
resistors provide very weak current, but can activate up to 4 TTL inputs of LS
series.
 If all 8 bits of a port are active, then the total current must be limited to 15mA
(port P0: 26mA).
 If all ports (32 bits) are active, then the total maximum current must be limited to
71mA.

Microcontrollers - 8051 Interrupts

Previous Page
Next Page
Interrupts are the events that temporarily suspend the main program, pass the control
to the external sources and execute their task. It then passes the control to the main
program where it had left off.
8051 has 5 interrupt signals, i.e. INT0, TFO, INT1, TF1, RI/TI. Each interrupt can be
enabled or disabled by setting bits of the IE register and the whole interrupt system can
be disabled by clearing the EA bit of the same register.

IE (Interrupt Enable) Register


This register is responsible for enabling and disabling the interrupt. EA register is set to
one for enabling interrupts and set to 0 for disabling the interrupts. Its bit sequence and
their meanings are shown in the following figure.

It disables all interrupts. When EA = 0 no interrupt will be acknowledged and


EA IE.7
EA = 1 enables the interrupt individually.

- IE.6 Reserved for future use.

- IE.5 Reserved for future use.

ES IE.4 Enables/disables serial port interrupt.

ET1 IE.3 Enables/disables timer1 overflow interrupt.

EX1 IE.2 Enables/disables external interrupt1.

ET0 IE.1 Enables/disables timer0 overflow interrupt.

EX0 IE.0 Enables/disables external interrupt0.

IP (Interrupt Priority) Register


We can change the priority levels of the interrupts by changing the corresponding bit in
the Interrupt Priority (IP) register as shown in the following figure.
 A low priority interrupt can only be interrupted by the high priority interrupt, but
not interrupted by another low priority interrupt.
 If two interrupts of different priority levels are received simultaneously, the
request of higher priority level is served.
 If the requests of the same priority levels are received simultaneously, then the
internal polling sequence determines which request is to be serviced.

- IP.6 Reserved for future use.

- IP.5 Reserved for future use.

PS IP.4 It defines the serial port interrupt priority level.

PT1 IP.3 It defines the timer interrupt of 1 priority.

PX1 IP.2 It defines the external interrupt priority level.

PT0 IP.1 It defines the timer0 interrupt priority level.

PX0 IP.0 It defines the external interrupt of 0 priority level.

TCON Register
TCON register specifies the type of external interrupt to the microcontroller.

You might also like