You are on page 1of 17

8051 MICROCONTROLLERS

The 8051 Microcontroller and Embedded


Systems: Using Assembly and C
Mazidi, Mazidi and McKinlay

Chung-Ping Young
楊中平

Home Automation, Networking, and Entertainment Lab


Dept. of Computer Science and Information Engineering
National Cheng Kung University, TAIWAN
‰ Microcontrollers and embedded
OUTLINES
processors
‰ Overview of the 8051 family

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 2
‰ General-purpose microprocessors
MICRO-
CONTROLLERS
contains
AND ¾ No RAM
EMBEDDED ¾ No ROM
PROCESSORS ¾ No I/O ports

Microcontroller
‰ Microcontroller has
vs. General- ¾ CPU (microprocessor)
Purpose ¾ RAM
Microprocessor ¾ ROM
¾ I/O ports
¾ Timer
¾ ADC and other peripherals

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 3
Data bus
MICRO- General-
purpose
CONTROLLERS Micro-
Processor I/O Serial
AND RAM ROM
Port
Timer COM
Port
EMBEDDED
PROCESSORS CPU
Address bus

Microcontroller
vs. General-
Purpose Microcontroller
Microprocessor CPU RAM ROM
(cont’)

Serial
I/O Timer COM
Port

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 4
‰ General-purpose microprocessors
MICRO-
¾ Must add RAM, ROM, I/O ports, and
CONTROLLERS timers externally to make them functional
AND ¾ Make the system bulkier and much more
EMBEDDED expensive
PROCESSORS ¾ Have the advantage of versatility on the
amount of RAM, ROM, and I/O ports
Microcontroller ‰ Microcontroller
vs. General- ¾ The fixed amount of on-chip ROM, RAM,
Purpose and number of I/O ports makes them ideal
Microprocessor for many applications in which cost and
(cont’) space are critical
¾ In many applications, the space it takes,
the power it consumes, and the price per
unit are much more critical considerations
than the computing power

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 5
‰ An embedded product uses a
MICRO- microprocessor (or microcontroller) to
CONTROLLERS do one task and one task only
AND
¾ There is only one application software that
EMBEDDED
is typically burned into ROM
PROCESSORS
‰ A PC, in contrast with the embedded
Microcontrollers system, can be used for any number of
for Embedded applications
Systems ¾ It has RAM memory and an operating
system that loads a variety of applications
into RAM and lets the CPU run them
¾ A PC contains or is connected to various
embedded products
ƒ Each one peripheral has a microcontroller inside
it that performs only one task

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 6
‰ Home
MICRO- ¾ Appliances, intercom, telephones, security systems,
CONTROLLERS garage door openers, answering machines, fax
AND machines, home computers, TVs, cable TV tuner,
VCR, camcorder, remote controls, video games,
EMBEDDED cellular phones, musical instruments, sewing
PROCESSORS machines, lighting control, paging, camera, pinball
machines, toys, exercise equipment
Microcontrollers ‰ Office
for Embedded ¾ Telephones, computers, security systems, fax
Systems machines, microwave, copier, laser printer, color
printer, paging
(cont’)
‰ Auto
¾ Trip computer, engine control, air bag, ABS,
instrumentation, security system, transmission
control, entertainment, climate control, cellular
phone, keyless entry

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 7
‰ Many manufactures of general-purpose
MICRO- microprocessors have targeted their
CONTROLLERS microprocessor for the high end of the
AND
embedded market
EMBEDDED
¾ There are times that a microcontroller is
PROCESSORS
inadequate for the task
x86 PC ‰ When a company targets a general-
Embedded purpose microprocessor for the
Applications embedded market, it optimizes the
processor used for embedded systems
‰ Very often the terms embedded
processor and microcontroller are used
interchangeably

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 8
‰ One of the most critical needs of an
MICRO- embedded system is to decrease
CONTROLLERS power consumption and space
AND
EMBEDDED ‰ In high-performance embedded
PROCESSORS processors, the trend is to integrate
more functions on the CPU chip and let
x86 PC designer decide which features he/she
Embedded wants to use
Applications ‰ In many cases using x86 PCs for the
(cont’)
high-end embedded applications
¾ Saves money and shortens development
time
ƒ A vast library of software already written
ƒ Windows is a widely used and well understood
platform
Department of Computer Science and Information Engineering
HANEL National Cheng Kung University, TAIWAN 9
‰ 8-bit microcontrollers
MICRO-
CONTROLLERS ¾ Motorola’s 6811
AND ¾ Intel’s 8051
EMBEDDED ¾ Zilog’s Z8
PROCESSORS ¾ Microchip’s PIC

Choosing a ‰ There are also 16-bit and 32-bit


Microcontroller microcontrollers made by various chip
makers

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 10
‰ Meeting the computing needs of the
MICRO-
CONTROLLERS
task at hand efficiently and cost
AND effectively
EMBEDDED ¾ Speed
PROCESSORS ¾ Packaging
¾ Power consumption
Criteria for
¾ The amount of RAM and ROM on chip
Choosing a
Microcontroller ¾ The number of I/O pins and the timer on
chip
¾ How easy to upgrade to higher-
performance or lower power-consumption
versions
¾ Cost per unit

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 11
‰ Availability of software development
MICRO- tools, such as compilers, assemblers,
CONTROLLERS and debuggers
AND
EMBEDDED ‰ Wide availability and reliable sources
PROCESSORS of the microcontroller
¾ The 8051 family has the largest number of
Criteria for diversified (multiple source) suppliers
Choosing a ƒ Intel (original)
ƒ Atmel
Microcontroller
(cont’) ƒ Philips/Signetics
ƒ AMD
ƒ Infineon (formerly Siemens)
ƒ Matra
ƒ Dallas Semiconductor/Maxim

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 12
‰ Intel introduced 8051, referred as MCS-
OVERVIEW OF 51, in 1981
8051 FAMILY ¾ The 8051 is an 8-bit processor
ƒ The CPU can work on only 8 bits of data at a
time
8051
Microcontroller ¾ The 8051 had
ƒ 128 bytes of RAM
ƒ 4K bytes of on-chip ROM
ƒ Two timers
ƒ One serial port
ƒ Four I/O ports, each 8 bits wide
ƒ 6 interrupt sources
‰ The 8051 became widely popular after
allowing other manufactures to make
and market any flavor of the 8051, but
remaining code-compatible
Department of Computer Science and Information Engineering
HANEL National Cheng Kung University, TAIWAN 13
External
Interrupts
OVERVIEW OF
8051 FAMILY

Counter Inputs
On-chip
Interrupt ROM On-chip Etc.
Control Timer 0
8051 for code RAM Timer 1
Microcontroller
(cont’)
CPU

OSC Bus I/O Serial


Control Ports Port

P0 P1 P2 P3 TXD RXD

Address/Data

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 14
‰ The 8051 is a subset of the 8052
OVERVIEW OF
8051 FAMILY ‰ The 8031 is a ROM-less 8051
¾ Add external ROM to it
8051 Family ¾ You lose two ports, and leave only 2 ports
for I/O operations

Feature 8051 8052 8031


ROM (on-chip program
4K 8K 0K
space in bytes)
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

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 15
‰ 8751 microcontroller
OVERVIEW OF
8051 FAMILY ¾ UV-EPROM
ƒ PROM burner
Various 8051 ƒ UV-EPROM eraser takes 20 min to erase
Microcontrollers ‰ AT89C51 from Atmel Corporation
¾ Flash (erase before write)
ƒ ROM burner that supports flash
ƒ A separate eraser is not needed
‰ DS89C4x0 from Dallas Semiconductor,
now part of Maxim Corp.
¾ Flash
ƒ Comes with on-chip loader, loading program to
on-chip flash via PC COM port

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 16
‰ DS5000 from Dallas Semiconductor
OVERVIEW OF
8051 FAMILY ¾ NV-RAM (changed one byte at a time),
RTC (real-time clock)
Various 8051 ƒ Also comes with on-chip loader
Microcontrollers ‰ OTP (one-time-programmable) version
(cont’) of 8051
‰ 8051 family from Philips
¾ ADC, DAC, extended I/O, and both OTP
and flash

Department of Computer Science and Information Engineering


HANEL National Cheng Kung University, TAIWAN 17

You might also like