0% found this document useful (0 votes)
6 views23 pages

Lecture 6

The Intel 8051 microcontroller is a widely used 8-bit microcontroller that has inspired a family of clones known as MCS-51. It features 64 KB of on-chip program memory, 128 bytes of data memory, and various I/O ports, making it suitable for applications in control systems, telecommunications, and robotics. The architecture includes a CPU, RAM, Flash memory, and multiple peripherals, with a strong presence in the embedded chip market.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views23 pages

Lecture 6

The Intel 8051 microcontroller is a widely used 8-bit microcontroller that has inspired a family of clones known as MCS-51. It features 64 KB of on-chip program memory, 128 bytes of data memory, and various I/O ports, making it suitable for applications in control systems, telecommunications, and robotics. The architecture includes a CPU, RAM, Flash memory, and multiple peripherals, with a strong presence in the embedded chip market.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MICROCONTROLLERS

8051 MICROCONTROLLER
The Intel 8051 microcontroller is one of the most popular general purpose microcontrollers
in use today. The success of the Intel 8051 spawned a number of clones which are collectively
referred to as the MCS-51 family of microcontrollers, which includes chips from vendors such
as Atmel, Philips, Infineon, and Texas Instruments

The Intel 8051 is an 8-bit microcontroller which means that most available operations are
limited to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short
and Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051
models often have a different form factor, and are not "drop-in compatible". All these things are
called 8051 because they can all be programmed using 8051 assembly language, and they all
share certain features (although the different models all have their own special features).

Some of the features that have made the 8051 popular are:

 64 KB on chip program memory.


 128 bytes on chip data memory (RAM).
 4 register banks.
 128 user defined software flags.
 8-bit data bus
 16-bit address bus
 32 general purpose registers each of 8 bits
 16 bit timers (usually 2, but may have more, or less).
 3 internal and 2 external interrupts.
 Bit as well as byte addressable RAM area of 16 bytes.
 Four 8-bit ports, (short models have two 8-bit ports).
 16-bit program counter and data pointer.
 1 Microsecond instruction cycle with 12 MHz Crystal.

8051 models may also have a number of special, model-specific features, such as UARTs,
ADC, Op-Amps, etc...
Typical applications:
8051 chips are used in a wide variety of control systems, telecom applications, robotics as
well as in the automotive industry. By some estimation, 8051 family chips make up over 50%
of the embedded chip market.

Fig 1: Pin diagram of the 8051 DIP

Basic Pins:
Pin 9: PIN 9 is the reset pin which is used reset the microcontroller‘s internal registers and
ports upon starting up. (Pin should be held high for 2 machine cycles.)

Pins 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a
crystal at these pins to provide clock pulses to the circuit.

Pin 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V
500mA to function properly, although there are lower powered versions like the Atmel 2051
which is a scaled down version of the 8051 which runs on +3V.

Pins 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash
memory. In order to program this we need to supply a voltage of +12V at pin 31. If external
memory is connected then PIN 31, also called EA/VPP, should be connected to ground to indicate
the presence of external memory. PIN 30 is called ALE (address latch enable), which is used
when multiple memory chips are connected to the controller and only one of them needs to be
selected. We will deal with this in depth in the later chapters. PIN 29 is called PSEN. This is
"program store enable". In order to use the external memory it is required to provide the low
voltage (0) on both PSEN and EA pins.
Ports:
There are 4 8-bit ports: P0, P1, P2 and P3.

PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used
for a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or
additional functions associated with them based upon the context of their usage.

PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional
functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external
counter inputs, read and write pins for memory access.

PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no
external memory is present, but if external memory access is required then PORT P2 will
act as an address bus in conjunction with PORT P0 to access external memory. PORT P2
acts as A8-A15, as can be seen from fig 1.1

PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no
external memory is present, but if external memory access is required then PORT P0 acts
as a multiplexed address and data bus that can be used to access external memory in
conjunction with PORT P2. P0 acts as AD0-AD7, as can be seen from fig 1.1

Oscillator Circuits

The 8051 requires the existence of an external oscillator circuit. The oscillator circuit usually
runs around 12MHz, although the 8051 (depending on which specific model) is capable of
running at a maximum of 40MHz. Each machine cycle in the 8051 is 12 clock cycles,
giving an effective cycle rate at 1MHz (for a 12MHz clock) to 3.33MHz (for the
maximum 40MHz clock).
Internal Architecture
Data and Program Memory
The 8051 Microprocessor can be programmed in PL/M, 8051 Assembly, C and a number of
other high-level languages. Many compilers even have support for compiling C++ for an 8051.

Program memory in the 8051 is read-only, while the data memory is considered to be
read/write accessible. When stored on EEPROM or Flash, the program memory can be
rewritten when the microcontroller is in the special programmer circuit.

Program Start Address


The 8051 starts executing program instructions from address 0000 in the program memory.

Direct Memory
The 8051 has 256 bytes of internal addressable RAM, although only the first 128 bytes are
available for general use by the programmer. The first 128 bytes of RAM (from 0x00 to 0x7F)
are called the Direct Memory, and can be used to store data.

Special Function Register


The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80
to 0xFF. A, B, PSW, DPTR are called [Link] area of memory cannot be used for data or program
storage, but is instead a series of memory-mapped ports and registers. All port input and output can
therefore be performed by memory mov operations on specified addresses in the SFR. Also,
different status registers are mapped into the SFR, for use in checking the status of the 8051, and
changing some operational parameters of the 8051.

General Purpose Registers

The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that there are
essentially 32 available general purpose registers, although only 8 (one bank) can be directly
accessed at a time. To access the other banks, we need to change the current bank number in the flag
status register.

A and B Registers

The A register is located in the SFR memory location 0xE0. The A register works in a similar
fashion to the AX register of x86 processors. The A register is called the accumulator, and by
default it receives the result of all arithmetic operations. The B register is used in a similar manner,
except that it can receive the extended answers from the multiply and divide operations. When not
being used for multiplication and Division, the B register is available as an extra general-purpose
register.
EXTRA REVISION NOTES
8051 MICROCONTROLLER ARCHITECTURE AND
FEATURES

Whenever we are starting to work on a new device like a TV or Washing


Machine, we would start by understanding the capabilities of the device. We try
to understand the different features of the device like Motor RPM, load capacity
and Power Consumption, in case of a washing machine.

This is applicable even in our case i.e. when starting with 8051 microcontrollers,
it would be best if we started by learning the Internal Hardware Design of the
8051 Microcontroller, which is also called as the 8051 Microcontroller
Architecture.

In the next section, we will see the 8051 Microcontroller Architecture and few of
its important features. In – depth details about some important features like
8051 Memory Organization and 8051 Input / Output (I/O) Ports will be discussed
in a new tutorial.

8051 Microcontroller Architecture


The 8051 Microcontroller is an 8 – bit Microcontroller i.e. it can read, write and
process 8 – bit Data. There are a bunch of manufacturers like Atmel, NXP, TI,
who manufacture their own versions of 8051 Microcontroller.

Irrespective of the manufacturer, the internal hardware design i.e. the 8051
Microcontroller Architecture remains more or less the same. The following image
shows the 8051

The block diagram of the 8051 Microcontroller Architecture shows that 8051
Microcontroller consists of a CPU, RAM (SFRs and Data Memory), Flash
(EEPROM), I/O Ports and control logic for communication between the
peripherals.

All these different peripherals inside the 8051 Microcontroller will communicate
with each other via the 8 – bit Data Bus, also known as the internal data bus.
Microcontroller Architecture in a block diagram style.

8051 Microcontroller Architecture Features

We have seen the internal architecture of the 8051 Microcontroller in the above
section. Now, we will see the features of the 8051 Microcontroller Architecture.

NOTE: Some of the features like internal ROM and RAM will vary with the
specific model of the 8051 Microcontroller.

 8 – bit CPU with two Registers A (Accumulator) and B.


 Internal ROM of 8K Bytes – It is a flash memory that supports in –
system programming.
 Internal RAM of 256 Bytes – The first 128 Bytes of the RAM i.e. 00H
to 7FH is again divided in to 4 banks with 8 registers (R0 – R7) in
each bank, 16 bit addressable registers and 80 general purpose
registers. The higher 128 Bytes of the RAM i.e. 80H to FFH consists
of SFRs or Special Function Registers. Using SFRs we can control
different peripherals like Timers, Serial Port, all I/O Ports, etc.
 32 I/O Pins (Input / Output Pins) – Arranged as 4 Ports: P0, P1, P2
and P3.
 8- bit Stack Pointer (SP) and Processor Status Word (PSW).
 16 – bit Program Counter (PC) and Data Pointer (DPTR).
 Two 16 – bit Timers / Counters – T0 and T1.
 Control Registers – SCON, PCON, TCON, TMOD, IP and IE.
 Serial Data Transmitter and Receiver for Full – Duplex Operation –
SBUF.
 Interrupts: Two External and Three Internal.
 Oscillator and Clock Circuit.

Applications of 8051 Microcontroller


Even with the development of many advanced and superior Microcontrollers,
8051 Microcontroller is still being used in many embedded system and
applications.

Some of the applications of 8051 Microcontroller are mentioned below:

 Consumer Appliances (TV Tuners, Remote controls, Computers,


Sewing Machines, etc.)
 Home Applications (TVs, VCR, Video Games, Camcorder, Music
Instruments, Home Security Systems, Garage Door Openers, etc.)
 Communication Systems (Mobile Phones, Intercoms, Answering
Machines, Paging Devices, etc.)
 Office (Fax Machines, Printers, Copiers, Laser Printers, etc.)
 Automobiles (Air Bags, ABS, Engine Control, Transmission Control,
Temperature Control, Keyless Entry, etc)
 Aeronautical and Space
 Medical Equipment
 Defense Systems
 Robotics
 Industrial Process and Flow Control
 Radio and Networking Equipment
 Remote Sensing
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.

You might also like