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

8051 Microcontroller Overview and Applications

Microprocessor notes with full explanation related to innovative ideas

Uploaded by

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

8051 Microcontroller Overview and Applications

Microprocessor notes with full explanation related to innovative ideas

Uploaded by

abhimsvm311091
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Microprocessor,

Microcontroller
and its
Application
COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4
Faculty
Dr. Gagan Deep Meena
Department of Electrical Engineering
NIT Patna

1
Unit 5

Introduction to 8051 microcontrollers: Microprocessors and


Microcontrollers, External memory, Processor Architecture – Harvard v/s
Princeton; CISC v/s RISC, Features of 8051 microcontrollers, 8051
Architecture, RAM organization, ROM structure, Hardware Features: 8051
– Device packaging, Chip technology, Power considerations, Reset,
System clock/oscillators, brief discussion on Parallel I/O, Timers,
Interrupts, Serial I/O, Pin configuration.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 2
Microcontrollers
● Born of parallel developments in computer architecture and integrated circuit fabrication, the
microprocessor, or "computer on a chip," first became a commercial reality in 1971 with the
introduction of the 4-bit 4004 by a small, unknown company by the name of Intel Corporation.

● Other, more well-established, semiconductor firms soon followed Intel's pioneering technology so
that by the late 1970s one could choose from a half dozen or so microprocessor types.

● The 1970s also saw the growth of the number of personal computer users from a handful of
hobbyists and "hackers" to millions of business, industrial, governmental, defense, educational,
and private users now enjoying the advantages of inexpensive computing.

● A by-product of microprocessor development was the microcontroller. The same fabrication


techniques and programming concepts that make possible the general-purpose microprocessor
also yielded the microcontroller.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 3
Microcontrollers

• Microcontrollers are not as well known to the general public, or even


the technical community, as are the more glamorous microprocessors.
• The public is, however, very well aware that "something" is responsible
for all of the smart VCRs, clock radios, washers, and dryers, video
games, telephones, microwaves, TVs, automobiles, toys, vending
machines, copiers, elevators, irons, and a myriad of other articles that
have suddenly become intelligent and "programmable."
• Companies are also aware that being competitive in this age of the
microchip requires their products, or the machinery they use to make
those products, to have some "smarts."

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 4
Microprocessors and Microcontroller
Microprocessors and microcontrollers stem from the same basic idea, are made by the same people, and are sold to
the same types of system designers and programmers. What is the difference between the two?

Microcontrollers : True computer on a chip.


● The design incorporates all of the features found in a microprocessor CPU: ALU, PC, SP, and registers.
○ It also has added the other features needed to make a complete computer: ROM, RAM, parallel I/O, serial I/O,
counters, and a clock circuit.
● Like the microprocessor, a microcontroller is a general-purpose device, but one which is meant to fetch data, perform
limited calculations on that data, and control its environment based on those calculations. The prime use of a
microcontroller is to control the operation of a machine using a fixed program that is stored in ROM and that does not
change over the lifetime of the system.

● The design approach of the microcontroller mirrors that of the microprocessor: make a single design that can be
used in as many applications as possible in order to sell, hopefully, as many as possible.

● The microprocessor design accomplishes this goal by having a very flexible and extensive repertoire of multi-byte
instructions.
○ These instructions work in a hardware configuration that enables large amounts of memory and I/O to be connected
to address and data bus pins on the integrated circuit package.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 5
Microprocessors and Microcontroller

● Much of the activity in the microprocessor has to do with moving code and data words to and
from external memory to the CPU.
● The architecture features working registers that can be programmed to take part in the
memory access process, and the instruction set is aimed at expediting this activity in order to
improve throughput. The pins that connect the microprocessor to external memory are
unique, each having a single function. Data is handled in byte, or larger, sizes.
● The microcontroller design uses a much more limited set of single- and double-byte
instructions that are used to move code and data from internal memory to the ALU.
○ Many instructions are coupled with pins on the integrated circuit package; the pins are
"programmable"-that is, capable of having several different functions depending upon the
wishes of the programmer.
○ The microcontroller is concerned with getting data from and to its own pins;
○ The architecture and instruction set are optimized to handle data in bit and byte size.

6
Microprocessors and Microcontroller

• The contrast between a microcontroller and a microprocessor is best exemplified by the


fact that most microprocessors have many operational codes (opcodes) for moving data
from external memory to the CPU; microcontrollers may have one, or two.
• Microprocessors may have one or two types of bit-handling instructions;
microcontrollers will have many.
• To summarize, the microprocessor is concerned with rapid movement of code and data
from external addresses to the chip; the microcontroller is concerned with rapid
movement of bits within the chip.
• The microcontroller can function as a computer with the addition of no external digital
parts; the microprocessor must have many additional parts to be operational.

7
Feature Microprocessor
Microcontroller

Definition CPU on a single chip CPU + memory +


peripherals on a single chip
Components Included Only the processor (needs Processor + RAM + ROM + I/O ports
external RAM, ROM, I/O) + timers all on-chip
Memory Mostly external Mostly internal
I/O Ports Requires external chips Built-in I/O ports
System Cost Higher (needs many external Lower (most components
integrated)
components)
Speed Generally faster, suited for Slower compared to
microprocessors
high-performance tasks
Power Consumption Higher Lower (used in
embedded battery-powered
devices)
Application Type General-purpose computing Dedicated applications (washing
machines,
(PCs, servers) remote controls, cars)
Design Complexity Complex hardware design
Simple hardware design 8
Size of System Larger system
Microprocessors and Microcontroller

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 9
Four-Bit Microcontrollers

Although 4 bits, in this era of 64-bit "maximicros," may seem somewhat ludicrous, one must recall that the
original 4004 was a 4-bit device, and all else followed. Indeed, in terms of production numbers, the 4-bit
microcontroller is today the most popular micro made. The following table lists representative models from
major manufacturers' data books. Many of these designs have been licensed to other vendors.

These 4-bit microcontrollers are generally intended for use in large volumes as true 1-chip computers;
expanding external memory, while possible, would negate the cost advantage desired. Typical applications
consist of appliances and toys: worldwide volumes run into the tens of millions.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 10
Eight-Bit Microcontrollers

Eight-bit microcontrollers represent


a transition zone between the
dedicated, high volume. 4-bit
microcontrollers, and the high
performance. Eight bits has proven
to be a very useful word size for
small computing tasks. Cаpable of
256 decimal values, or quarter-
percent resolution, the I-byte word
is adequate for many control and
monitoring applications. Serial
ASCII data is also stored in byte
sizes, making 8 bits the natural
choice for data communications.
Most integrated circuit memories
and many logic functions are
arranged in an 8-bit configuration
that interfaces easily to data buses
of 8 bits.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 11
Sixteen-Bit Microcontrollers

Sixteen-bit microcontrollers have evolved to solve high-speed control problems of the type that might
typically be confronted in the control of servomechanisms, such as robot arms, or for digital signal
processing (DSP) applications.

The pulse width modulation (PWM) output is useful for controlling motor speed; it can be done using
software in the 8-bit units with the usual loss of time for other tasks.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 12
Thirty Two-Bit Microcontrollers
The following table provides a general list of the capability of the Intel 80960:
• Crossing the boundary from 16 to 32 bits
involves more than merely doubling the word
size of the computer.

• Software boundaries that separate dedicated


programs from supervisory programs are also
breached.

• Thirty two bit designs target robotics, highly


intelligent instrumentation, avionics, image
processing, telecommunications, automobiles, All of the functions needed for 1/O, data communications, and timing and
and other environments that feature counting are done by adding other specialized chips.
application programs running under an
operating system.
• The line between microcomputers and
microcontrollers becomes very fine here. The
design emphasis now switches from on-chip
features, such as RAM, ROM, timers, and
serial ports, to high-speed computation
features.
Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 13
Processor Architecture – Princeton v/s Harvard

Princeton Architecture Harvard Architecture


I/O I/O
Peripherals Peripherals
I
Registers N
T
system bus
E I
Registers N

ALU R
F
T
E
ALU R
Instruction
A F

C Data Memory A Memory


Timing and Control Timing and Control C
E
E
Memory

Proposed by John Von Neumann,


at Princeton University
Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 14
Processor Architecture – Princeton v/s Harvard

Feature Princeton Architecture Harvard Architecture

Program & Data Memory A single memory is used for both program and data. Separate memories for program and data.

Buses A single bus for instructions and data. Separate program bus and data bus.

Instruction Fetch vs Data Cannot happen simultaneously (single bus bottleneck). Can happen in parallel, improving performance.
Access

Memory Organization Unified address space. Different address spaces for program and
data.
Speed Generally slower because fetching instructions & data Faster access due to parallel instruction
competes on the same bus. fetch + data access.

The 8051 uses the Harvard Architecture. Kahe?


● Program memory (ROM) and data memory (RAM) are separate.
It has:
○ A 16-bit Program Counter (PC) that addresses program memory.
○ An 8-bit Data Pointer (DPTR) and internal RAM addressing for data.
● The 8051 can fetch an instruction from program memory while reading/writing data in RAM—classic Harvard
behavior.
Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 15
RISC & CISC
RISC (Reduced Instruction Set Computer)
RISC is a type of computer architecture that uses a small number of simple instructions. Each instruction is designed to execute very fast, usually in one clock cycle.

Key points:

● Simple, fixed-length instructions


● Many registers
● Easy pipelining → high performance
● Used in ARM, RISC-V, MIPS, SPARC

CISC (Complex Instruction Set Computer)


CISC is a computer architecture that uses a large set of complex instructions. Many instructions perform multiple operations within a single instruction.

Key points:

● Large, variable-length instructions


● Fewer registers
● Harder to pipeline
● Used in Intel/AMD x86 processors

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 16
Feature RISC (Reduced Instruction Set Computer) CISC (Complex Instruction Set Computer)

Instruction Set Small, simple, and limited instructions. Large number of complex
instructions.
Instruction Length Fixed length (usually 32 bits). Variable length (8–64 bits).
Execution Speed Faster—most instructions execute in one clock Slower—complex instructions take multiple
cycle. cycles.

Hardware Simple hardware, easier pipelining. Complex hardware (microcoded


Complexity
instructions).
Memory Usage More instructions needed → larger Fewer instructions needed → smaller
code size. code size.
Microprogramming Not used (hardwired control). Often used (microcoded control unit).
Registers Large number of registers. Fewer registers.
Pipelining Easy to implement and highly efficient. Difficult due to variable-length
instructions.
Addressing Modes Few addressing modes. Many addressing modes.
Primary Focus Speed → optimized for instruction Complexity → optimized for powerful
throughput. instructions.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 17
Main Features of the 8051 Microcontroller

1. 8-bit CPU 6. Full Duplex Serial Port 10. Powerful Instruction Set
● Processes 8-bit data at a time.
● Supports UART communication. ● 255 instructions.
● 8-bit ALU (Arithmetic Logic Unit). ● Supports moving, arithmetic, logic,
● Can do simultaneous transmission and
reception. branching, bit manipulations.
2. Harvard Architecture

● Separate program and data memory.


7. Five Interrupt Sources 11. On-chip Bus Structure
● Allows parallel instruction fetch and data access.

● 2 external interrupts → INT0, INT1 ● Separate buses for program and data
3. On-chip Memory
● 2 timer interrupts → T0, T1 (Harvard).
● 4 KB ROM/Flash (in standard 8051) ● 1 serial interrupt → for Tx/Rx ● 16-bit program counter.
● 128 bytes internal RAM ● Supports interrupt priority. ● 8-bit data pointer (DPTR).
● 128 bytes Special Function Registers (SFRs)
● Up to 64 KB external program memory
● Up to 64 KB external data memory 8. Oscillator and Clock Circuit 12. Power-saving Modes

4. 32 I/O Lines ● On-chip oscillator. ● Idle Mode – CPU off, peripherals


● Typically uses 12 MHz crystal (1 machine active.
● Four 8-bit ports: P0, P1, P2, P3. ● Power-Down Mode – Entire chip off
● Total 32 digital I/O pins. cycle = 12 clock cycles in classic 8051).
except retention of RAM.
5. Two 16-bit Timers/Counters 9. Boolean Processor
● Timer 0
● Special bit-addressable memory.
● Timer 1
● Used for timing, delays, counting pulses, baud rate generation.
● Supports bit-level operations efficiently.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 18
8051 Microcontroller Hardware Counter and Timers
The 8051 Timer Counter Interrupts
• The 8051 Oscillator and Clock Architecture Timing
• Program Counter and Data Timer Modes of Operation
Pointer Timer Mode 0
• A and B CPU Registers Timer Mode 1
Input/Output Pins, Ports, and Timer Mode 2
• Flags and the Program Status
Circuits Timer Mode 3
Word (PSW) Internal Memory
Port 0, Port 1, Port 2, Port 3 Counting
• Internal RAM
• The Stack and the Stack Pointer Serial Data Input/Output
• Special Function Registers Serial Data Interrupts
• Internal ROM Data Transmission Interrupt
Data Reception Serial Port Interrupt
Serial Data Transmission Modes External Interrupts
External Memory Reset
Serial Data Mode 0-Shift Register Mode
Connecting External Interrupt Control
Serial Data Mode 1-Standard UART Interrupt Enable/Disable
Memory
Mode 1 Baud Rates Interrupt Priority
Serial Data Mode 3 Interrupt Destinations
Interrupts Software Generated
Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4
Timer Flag Interrupts 19
The 8051 Microcontroller Hardware

The 8051 microcontroller actually


includes a whole family of
microcontrollers that have numbers
ranging from 8031 to 8751 and are
available in N-Channel Metal Oxide
Silicon (NMOS) and Complementary
Metal Oxide Silicon (CMOS)
construction in a variety of package
types.

An enhanced version of the 8051, the


8052, also exists with its own family
of variations and even includes one
member that can be programmed in
BASIC.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 20
The Programming Model

The programming model of the


8051 in Figure shows the 8051 as a
collection of 8- and 16-bit registers
and 8-bit memory locations.

These registers and memory


locations can be made to operate
using the software instructions that
are incorporated as part of the
design.

The program instructions have to


do with the control of the registers
and digital data paths that are
physically contained inside the
8051, as well as memory locations
that are physically located outside
the 8051.
Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 21
Pin Assignments for 8051

It is important to note that many of the pins


are used for more than one function (the
alternate functions are shown in parentheses
in Figure). Not all of the possible 8051
features may be used at the same time.

Programming instructions or physical pin


connections determine the use of any
multifunction pins. For example, port 3 bit 0
(abbreviated P3.0) may be used as a general
purpose I/O pin, or as an input (RXD) to
SBUF, the serial data receiver register. Note: Alternate functions
are shown below the port
The system designer decides which of these name (in parentheses).
Pin numbers and pin
two functions is to be used and designs the names are shown inside
hardware and software affecting that pin the DIP package.
accordingly.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 22
The 8051 Oscillator and Clock

The heart of the 8051 is the circuitry that generates the clock pulses by which all internal operations are
synchronized. Pins XTAL1 and XTAL2 are provided for connecting a resonant network to form an oscillator.
Typically, a quartz crystal and capacitors are employed, as shown in Figure of Pin assignment.

The crystal frequency is the basic internal clock frequency of the microcontroller. The manufacturers make available
8051 designs that can run at specified maximum and minimum frequencies, typically 1 megahertz to 16 megahertz.
Minimum frequencies imply that some internal memories are dynamic and must always operate above a minimum
frequency, or data will be lost.

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 23
Clock frequency

The clock frequency, f establishes the smallest interval of time within the microcontroller, called the pulse, P
time.

The smallest interval of time to accomplish any simple instruction, or part of a complex instruction,
however, is the machine cycle. The machine cycle is itself made up of six states.

A state is the basic time interval for discrete operations of the microcontroller such as fetching an opcode
byte, decoding an opcode, executing an opcode, or writing a data byte. Two oscillator pulses define each
state.
To calculate the time any particular instruction will take to be executed, find the number of cycles, C, from
the instruction set. The time to execute that instruction is then found by multiplying C by 12 and dividing
the product by the crystal frequency:

Microprocessor, Microcontroller and its Application - COURSE CODE: EE56103, L-T-P-Cr: 3-0-2-4 24
Thanks!
The presentation is made using

25

You might also like