Chapter 2 - 8051 Microcontroller
Chapter 2 - 8051 Microcontroller
Microcontroller
CHAPTER OBJECTIVES
Understand the architecture of 8051 microcontroller
State the pins and thier function of 8051 microcontroller
Discuss the basic circuits required fot the functioning of
8051 microcontroller
Discuss the memory organizations of 8051
microcontroller
Explain the interfacing of external memory of 8051
microcontroller
CONTENT
Introduction
8051 architecture
8051 basic circuit
Memory organization
Interfacing external memory
1. INTRODUCTION
The 8051 microcontroller is a basic
microcontroller, it is first introduced by the ‘Intel
Corporation’ since 1970.
It is developed by the 8086 processor
architecture.
The 8051 is a family of the microcontroller,
which has been developed by different
manufactures such as Philips, Atmel, Dallas,
and so on.
The 8051 microcontroller has been used in
lots of embedded products from small
children’s toys to large automotive systems.
1. INTRODUCTION (CONT.)
Even though Intel developed 8051 Microcontrollers, more
than 20 semiconductor manufacturers are still
producing 8051 compatible microcontrollers i.e.
processors based on MCS-51 Architecture.
Some of the 8051 Microcontrollers produced by different
manufacturers are:
Atmel (AT89C51, AT89S51),
Phillips (S87C654),
Siemens (SAB-C501),
The 8051 is an 8-bit processor, meaning that the CPU can work on
only 8 bits of data at a time.
Data larger than 8 bits has to be broken into 8-bit pieces to be
the events.
In 8051, there are two timer pins T0, T1.
If these pins are used in the counter mode, we can count the
external pulses.
In T0, it is possible to store 16 bit data. This is done by storing
the lower 8 bit in TL0 and the upper 8 bit in TH0. Similarly, we
can store 16 bit data in T1 also.
TMOD and TCON helps in the timer operation.
2. 8051 ARCHITECTURE (CONT.)
The basic architecture of 8051 consists of:
Serial Port: In order, to perform the serial communication, TXD and RXD pins
are used.
TXD pin is used for transmitting the serial data and the RXD pin is used
Port P2 can be used as I/O port and higher order bus A8 to A15.
Port P3 can be used as I/O pin and each pin of port 3 has special
functions.
Oscillator – This is used to provide clock to the 8051 microcontroller.
The crystal frequency can vary from 4MHz to 30MHz.
Parity Flag,
Overflow flag.
3. 8051 PIN DESCRIPTION
The PIN arrangement of 8051 microcontroller:
3. 8051 PIN DESCRIPTION (CONT.)
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.
3. 8051 PIN DESCRIPTION (CONT.)
Pin
29 − this is PSEN pin which stands for Program Store
Enable.
It is used to read a signal from the external program memory.
Pin30 − this is EA pin which stands for External Access
input.
It is used to enable/disable the external memory interfacing.
Pin31 − 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.
4. 8051 BASIC CIRCUIT
The following image shows the basic circuit of the 8051
microcontroller
4. 8051 BASIC CIRCUIT (CONT.)
The minimal interface required for it to work
Power supply
40pF.
The frequency of this crystal determines the machine cycle.
MHz
4. 8051 BASIC CIRCUIT (CONT.)
The minimal interface required for it to work (cont.)
PSEN: Pin 29. This is an output pin. PSEN stands for “program
store enable”.
In 8051 we leave this pin unconnected until otherwise mentioned.
ALE/PROG: Pin 30. ALE refers to address latch enable.
In 8051 we leave this pin unconnected until otherwise mentioned.
intermediate results.
8051 Microcontroller has both Internal ROM and Internal RAM.
If the internal memory is inadequate, you can add external memory
Some variants of 8051 like the 8031 and 8032 series doesn’t have any
Data pointer
Stack pointer
indirect addressing.
5.1. INTERFACING EXTERNAL MEMORY
A typical 8051 Microcontroller has 4KB of ROM and 128B of
RAM (most modern 8051 Microcontroller variants have 8K ROM
and 256B of RAM).
The designer of an 8051 Microcontroller based system is not
limited to the internal RAM and ROM present in the 8051
Microcontroller.
There is a provision of connecting both external RAM and