Introduction to 8051
8051
microcontroller is an 8-bit microcontroller made by Intel Corporation in early
1980s. It’s available in N-channel Metal Oxide Silicon (NMOS) and Complementary
Metal Oxide Silicon (CMOS) construction in a variety of package types. It’s an
8-bit microcontroller that means
that it can handle 8-bit of data at a time. It has an inbuilt RAM of 256 byte
and also 4K byte of ROM all this combined with 32 I/O pins, serial port etc on
a single chip. Comparing it with a microprocessor we can infer that it is an
example of system on chip as it has all these components
embedded on a single chip.
Various versions of
8051 microcontrollers are available in the market all have slight differences
in terms of configurations but there basic architecture remains the same. There
are many manufacturers that manufacture 8051 microcontroller all of them have a
distinct feature but as discussed earlier they all have same basic
architecture. So you can work on any available product if you are familiar with
the basic of 8051 architecture as they all are same at root level.
8051
microcontroller is based on Harvard architecture i.e. it has physically
separate storage and pathway for instructions and data hence the
microcontroller can fetch the instruction as well as access the data from
memory at the same time. This greatly enhances the performance as compared to
von Neumann architecture in which the microcontroller can be
either reading an instruction or reading/writing data from/to the memory. Both
cannot occur at the same time since the instructions and data use the same bus
system.
Why 8051
8051
microcontroller is one of the most widely used microcontrollers in the world.
This is a fact for various reasons that include its cost effectiveness, wide
range of functions it can perform. It can perform various functions because of
certain features it have which are suitable for large range of small
applications. Some of the features are enlisted below
- It contains 128 byte of inbuilt RAM that can be extended up to 64K bytes.
- It contains 4K bytes of internal ROM, which also can be extended up to 64Kbytes.
- It has 8-bit data bus.
- It has an address bus of 16-bit therefore capable of addressing 216 = 65536 (64K bytes of memory).
- It has four I/O ports each 8-bit wide. Each port have 8 pins so a total of 32 I/O pins are present each capable of connecting a peripheral.
- It has two 16-bit counter/timers. Each divided into a higher and a lower unit of 8-bit each.
- It has two pins dedicated for serial communication one being TXD (transmitter pin) and other being RXD (receiver pin).
- It has an inbuilt UART for enabling efficient serial communication.
- It has a dedicated reset pin in active high configuration.
- It can entertain a total of 6 interrupts. That includes 2 external interrupts, 3 internal interrupts and a reset interrupt.
Due to its wide usage there
are a large number of compilers and simulation tools available for 8051
microcontroller which makes it easy for a developer to work on it and get
desired results
Block Diagram of 8051
Microcontroller:
Introduction to 8051
8051
microcontroller is an 8-bit microcontroller made by Intel Corporation in early
1980s. It’s available in N-channel Metal Oxide Silicon (NMOS) and Complementary
Metal Oxide Silicon (CMOS) construction in a variety of package types. It’s an
8-bit microcontroller that means
that it can handle 8-bit of data at a time. It has an inbuilt RAM of 256 byte
and also 4K byte of ROM all this combined with 32 I/O pins, serial port etc on
a single chip. Comparing it with a microprocessor we can infer that it is an
example of system on chip as it has all these components
embedded on a single chip.
Various versions of
8051 microcontrollers are available in the market all have slight differences
in terms of configurations but there basic architecture remains the same. There
are many manufacturers that manufacture 8051 microcontroller all of them have a
distinct feature but as discussed earlier they all have same basic
architecture. So you can work on any available product if you are familiar with
the basic of 8051 architecture as they all are same at root level.
8051
microcontroller is based on Harvard architecture i.e. it has physically
separate storage and pathway for instructions and data hence the
microcontroller can fetch the instruction as well as access the data from
memory at the same time. This greatly enhances the performance as compared to
von Neumann architecture in which the microcontroller can be
either reading an instruction or reading/writing data from/to the memory. Both
cannot occur at the same time since the instructions and data use the same bus
system.
Why 8051
8051
microcontroller is one of the most widely used microcontrollers in the world.
This is a fact for various reasons that include its cost effectiveness, wide
range of functions it can perform. It can perform various functions because of
certain features it have which are suitable for large range of small
applications. Some of the features are enlisted below
- It contains 128 byte of inbuilt RAM that can be extended up to 64K bytes. It contains 4K bytes of internal ROM, which also can be extended up to 64Kbytes.
- It has 8-bit data bus.
- It has an address bus of 16-bit therefore capable of addressing 216 = 65536 (64K bytes of memory).
- It has four I/O ports each 8-bit wide. Each port have 8 pins so a total of 32 I/O pins are present each capable of connecting a peripheral.
- It has two 16-bit counter/timers. Each divided into a higher and a lower unit of 8-bit each.
- It has two pins dedicated for serial communication one being TXD (transmitter pin) and other being RXD (receiver pin).
- It has an inbuilt UART for enabling efficient serial communication.
- It has a dedicated reset pin in active high configuration.
- It can entertain a total of 6 interrupts. That includes 2 external interrupts, 3 internal interrupts and a reset interrupt.
Due to its wide usage there
are a large number of compilers and simulation tools available for 8051
microcontroller which makes it easy for a developer to work on it and get
desired results.
Block Diagram of 8051
Microcontroller:
Pin Diagram of 8051:
Pin Diagram of 8051:
Port 0(p0.0 to p0.7):
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory access, it functions as multiplexed data and low-order address bus AD0-AD7.
Port 1 (p1.0 to p1.7):
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. When logic '1' is written into port latch then it works as input mode. It functions as simply I/O port and it does not have any alternative function.
Port 2 (p2.0 to p2.7):
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory access it functions as higher order address bus (A8-A15).
Port 3(p3.0 to port 3.7):
It is 8-bit I/O port. In an alternating function each pins can be used as a special function I/O pin.
P3.0-RxD:
It is an Input signal. Through this I/P signal microcontroller receives serial data of serial communication circuit.
P3.1-TxD:
It is O/P signal of serial port. Through this signal data is transmitted.
P3.2- (INT0):
It is external hardware interrupt I/P signal. Through this user, programmer or peripheral interrupts to microcontroller.
P3.3-(INT1):
It is external hardware interrupt I/P signal. Through this user, programmer or peripheral interrupts to microcontroller.
P3.4- T0:
It is I/P signal to internal timer-0 circuit. External clock pulses can connects to timer-0 through this I/P signal.
P3.5-T1:
It is I/P signal to internal timer-1 circuit. External clock pulses can connects to timer-1 through this I/P signal.
P3.6-[WR(bar)]:
It is active low write O/P control signal. During External RAM (Data memory) access it is generated by microcontroller. when [WR(bar)]=0, then performs write operation.
P3.7-[RD(bar)]:
It is active low read O/P control signal. During External RAM (Data memory) access it is generated by microcontroller. when [RD(bar)]=0, then performs read operation from external RAM.
XTAL1 and XTAL2:
These are two I/P line for on-chip oscillator and clock generator circuit. A resonant network as quartz crystal is connected between these two pin. 8051 microcontroller also drives from external clock, then XTAL2 is used to drive 8051 from external clock and XTAL1 should be grounded.
[EA(bar)]/VPP:
It is and active low I/P to 8051 microcontroller. when (EA)= 0, then 8051 microcontroller access from external program memory (ROM) only. When (EA) = 1, then it access internal and external program memories (ROMS).
[PSEN(bar)]:
It is active low O/P signal. It is used to enable external program memory (ROM). When [PSEN(bar)]= 0, then external program memory becomes enabled and microcontroller read content of external memory location. Therefore it is connected to (OE) of external ROM. It is activated twice every external ROM memory cycle.
ALE:
Address latch enable: It is active high O/P signal. When it goes high, external address latch becomes enabling and lower address of external memory (RAM or ROM) latched into it. Thus it separates A0-A7 address from AD0-AD7. It provides properly timed signal to latch lower byte address. The ALE is activated twice in every machine cycle. If external RAM & ROM is not accessed, then ALE is activated at constant rate of 1/6 oscillator frequency, which can be used as a clock pulses for driving external devices.
RESET:
It is active high I/P signal. It should be maintained high for at least two machine cycle while oscillator is running then 8051 microcontroller resets.
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory access, it functions as multiplexed data and low-order address bus AD0-AD7.
Port 1 (p1.0 to p1.7):
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. When logic '1' is written into port latch then it works as input mode. It functions as simply I/O port and it does not have any alternative function.
Port 2 (p2.0 to p2.7):
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory access it functions as higher order address bus (A8-A15).
Port 3(p3.0 to port 3.7):
It is 8-bit I/O port. In an alternating function each pins can be used as a special function I/O pin.
P3.0-RxD:
It is an Input signal. Through this I/P signal microcontroller receives serial data of serial communication circuit.
P3.1-TxD:
It is O/P signal of serial port. Through this signal data is transmitted.
P3.2- (INT0):
It is external hardware interrupt I/P signal. Through this user, programmer or peripheral interrupts to microcontroller.
P3.3-(INT1):
It is external hardware interrupt I/P signal. Through this user, programmer or peripheral interrupts to microcontroller.
P3.4- T0:
It is I/P signal to internal timer-0 circuit. External clock pulses can connects to timer-0 through this I/P signal.
P3.5-T1:
It is I/P signal to internal timer-1 circuit. External clock pulses can connects to timer-1 through this I/P signal.
P3.6-[WR(bar)]:
It is active low write O/P control signal. During External RAM (Data memory) access it is generated by microcontroller. when [WR(bar)]=0, then performs write operation.
P3.7-[RD(bar)]:
It is active low read O/P control signal. During External RAM (Data memory) access it is generated by microcontroller. when [RD(bar)]=0, then performs read operation from external RAM.
XTAL1 and XTAL2:
These are two I/P line for on-chip oscillator and clock generator circuit. A resonant network as quartz crystal is connected between these two pin. 8051 microcontroller also drives from external clock, then XTAL2 is used to drive 8051 from external clock and XTAL1 should be grounded.
[EA(bar)]/VPP:
It is and active low I/P to 8051 microcontroller. when (EA)= 0, then 8051 microcontroller access from external program memory (ROM) only. When (EA) = 1, then it access internal and external program memories (ROMS).
[PSEN(bar)]:
It is active low O/P signal. It is used to enable external program memory (ROM). When [PSEN(bar)]= 0, then external program memory becomes enabled and microcontroller read content of external memory location. Therefore it is connected to (OE) of external ROM. It is activated twice every external ROM memory cycle.
ALE:
Address latch enable: It is active high O/P signal. When it goes high, external address latch becomes enabling and lower address of external memory (RAM or ROM) latched into it. Thus it separates A0-A7 address from AD0-AD7. It provides properly timed signal to latch lower byte address. The ALE is activated twice in every machine cycle. If external RAM & ROM is not accessed, then ALE is activated at constant rate of 1/6 oscillator frequency, which can be used as a clock pulses for driving external devices.
RESET:
It is active high I/P signal. It should be maintained high for at least two machine cycle while oscillator is running then 8051 microcontroller resets.