Professional Documents
Culture Documents
OCEAN UNIVERSITY
國立台灣海洋大學
Chapter 1
The 8051 Microcontrollers
http://tc-sfa.ee.ntou.edu.tw/micro/Chapter1.ppt
IC
06/01/19
2002 MuDer Jeng Edited by Syahrul 2
Outlines
Compare microprocessors & microcontrollers
Advantages of microcontrollers
Embedded systems
Choose a microcontroller
Speed, packaging, memory & cost per unit
Various members of 8051 family
Various manufacturers of 8051
06/01/19
2002 MuDer Jeng Edited by Syahrul 3
Microcontroller vs. Microprocessors
General-purpose microprocessor
CPU for Computers
No RAM, ROM, I/O on CPU chip itself
Example : 8 bits => Z-80, Z-180, MCS-51, PIC, AVR
16 bits = > 80286, M16, MSP430, Arm7
32 bits = > M32, 68332, Pentium
64 bits => Pentium4…
Many chips on mother’s board
Data Bus
CPU
General-
Serial
Purpose RAM ROM I/O Timer COM
Micro- Port
Port
processor
Address Bus
06/01/19
2002 MuDer Jeng Edited by Syahrul 4
Microcontroller vs. Microprocessors
Microcontroller :
A smaller computer
On-chip RAM, ROM, I/O ports...
Example : Motorola’s 6811, Intel’s 8051, Zilog’s Z8 and PIC 16X
Microcontroller
06/01/19
2002 MuDer Jeng Edited by Syahrul 5
06/01/19
2002 MuDer Jeng Edited by Syahrul 6
06/01/19
2002 MuDer Jeng Edited by Syahrul 7
06/01/19
2002 MuDer Jeng Edited by Syahrul 8
Microcontroller vs. Microprocessors
06/01/19
2002 MuDer Jeng Edited by Syahrul 9
Microprocessor vs. Microcontroller
Microprocessor Microcontroller
CPU is stand-alone, RAM, • CPU, RAM, ROM, I/O and
ROM, I/O, timer are separate timer are all on a single chip
designer can decide on the • fix amount of on-chip ROM,
amount of ROM, RAM and RAM, I/O ports
I/O ports. • for applications in which cost,
expansive power and space are critical
versatility • single-purpose
general-purpose
06/01/19
2002 MuDer Jeng Edited by Syahrul 10
MicroProcessor Unit (MPU)
Central Processor Unit (CPU)
Input 1
+
- Output
Input 2 *
/
06/01/19
2002 MuDer Jeng Edited by Syahrul 11
Microprocessor
START
EDIT
COMPILE
&
Link
NO
WORK? Control
YES
06/01/19
2002 MuDer Jeng Edited by Syahrul 14
Definitions of
“Embedded System”
1. A special-purpose computer that interacts with
the real world through sensing and/or actuation
2. A computer that you don’t think of as a
computer
3. Almost any computer that isn’t a PC
4. …
06/01/19
2002 MuDer Jeng Edited by Syahrul 15
More definitions
Microprocessor: A regular CPU
Microcontroller: A system on chip that contains extra
support for dealing with the real world
Analog to digital and digital to analog converters
Pulse width modulation
Networks: serial, I2C (Inter-integrated circuit), CAN
(controller area network), USB, 802.15.4, etc…
General-purpose I/O pins
Lots of interrupt lines
Low-power sleep modes
Voltage / frequency scaling
Temperature / vibration resistance
Onboard volatile and nonvolatile RAM
What else?
06/01/19
2002 MuDer Jeng Edited by Syahrul 16
Embedded Characteristics
Close interaction with the physical world
~ Often must operate in real time
Constrained resources
~ Memory
- SRAM, DRAM, flash, EEPROM, …
~ Energy
~ CPU cycles
~ Pins
~ Flash memory read / write cycles
~ What else?
06/01/19
2002 MuDer Jeng Edited by Syahrul 17
More Characteristics
Concurrent
~ Easy to make concurrency errors
~ Hard to find and fix them
Often lack:
~ Virtual memory
~ Memory protection
~ Hardware supported user-kernel boundary
~ Secondary storage
Have to be developed rapidly
Cost sensitive
~ Per-unit cost often dominates overall cost of a product
06/01/19
2002 MuDer Jeng Edited by Syahrul 18
Important Difference
Unlike PC software, embedded software is
developed in the context of a particular
piece of hardware
This is good:
~ Appl can be tailored very specifically to platform
~ In many cases writing portable software is not a
concern
This is bad:
~ All this tailoring is hard work
06/01/19
2002 MuDer Jeng Edited by Syahrul 19
06/01/19
2002 MuDer Jeng Edited by Syahrul 20
Embedded Computing Systems
Use a microprocessor or microcontroller to do one
task only
~ Printer
PC used for any number of applications
~ Word processor, print-server, bank teller terminal, video
game player, network server, internet terminal
PC contains or is connected to various embedded
products
~ Keyboard, printer, modem, disk controller, sound card,
CD-ROM driver, mouse
X86 PC embedded applications
06/01/19
2002 MuDer Jeng Edited by Syahrul 21
Embedded Products Using Microcontrollers
Home
– Appliances, intercom, telephones, security
systems, garage door openers, answering
machines, fax machines, home computers, TVs,
cable TV tuner, VCR, camcorder, remote
controls, video games, cellular phones, musical
instruments, sewing machines, lighting control,
paging, camera, pinball machines, toys,
exercise equipment
06/01/19
2002 MuDer Jeng Edited by Syahrul 22
Embedded Products Using Microcontrollers
Office
– Telephones, computers, security systems, fax
machines, microwave, copier, laser printer,
color printer, paging
06/01/19
2002 MuDer Jeng Edited by Syahrul 23
Embedded Products Using Microcontrollers
Auto
– Trip computer, engine control, air bag, ABS,
instrumentation, security system, transmission
control, entertainment, climate control, cellular
phone, keyless entry
06/01/19
2002 MuDer Jeng Edited by Syahrul 24
Examples of Embedded Systems
06/01/19
2002 MuDer Jeng Edited by Syahrul 25
06/01/19
2002 MuDer Jeng Edited by Syahrul 26
06/01/19
2002 MuDer Jeng Edited by Syahrul 27
06/01/19
2002 MuDer Jeng Edited by Syahrul 28
06/01/19
2002 MuDer Jeng Edited by Syahrul 29
06/01/19
2002 MuDer Jeng Edited by Syahrul 30
Thus, Embedded System is:
• Embedded system means the processor is
embedded into that application.
• An embedded product uses a microprocessor or
microcontroller to do one task only.
• In an embedded system, there is only one
application software that is typically burned into
ROM.
• Example : printer, keyboard, video game player
06/01/19
2002 MuDer Jeng Edited by Syahrul 31
06/01/19
2002 MuDer Jeng Edited by Syahrul 32
06/01/19
2002 MuDer Jeng Edited by Syahrul 33
06/01/19
2002 MuDer Jeng Edited by Syahrul 34
06/01/19
2002 MuDer Jeng Edited by Syahrul 35
Traditional Embedded System Design
SW and HW partitioning is decided at an early stage
Using commodity components, board level design
Software
Software Application Hardware
Hardware
Function
Compiler
Compiler
Assembler
Assembler
Linker
Linker
Off-the-shelf Implementation
Binary Off-the-shelf
Binaryon
onuController
uController hardware
hardware
06/01/19
2002 MuDer Jeng Edited by Syahrul 36
HW/SW Codesign Style
An integrated design flow of hardware and software
Often targeting SoCs, not constrained by commodity
components
Application
Application
Software
Software HW/SW Hardware
Hardware
Partitioning
Performance
Compilation, Estimation
Compilation,etc.
etc. Synthesis
Synthesis
Virtual
Virtualprototype
prototype
Cosimulation
Cosimulation
Processor
Processor++ Hardwired
Hardwired
Binary System-on-
BinaryCode
Code Components
Components
chip
06/01/19
2002 MuDer Jeng Edited by Syahrul 37
Three criteria in Choosing a Microcontroller
Computing needs
– Speed, packaging, power consumption, RAM,
ROM, I/O pins, timers, upgrade to high
performance or low-power versions, cost
Software development tools
– Assembler, debugger, C compiler, emulator,
technical support
Availability & source
06/01/19
2002 MuDer Jeng Edited by Syahrul 38
06/01/19
2002 MuDer Jeng Edited by Syahrul 39
Inside 8051 Microcontroller
The Intel 8051 is a Harvard architecture single chip
microcontroller which was developed by Intel in 1980 for use in
embedded systems.
Features: ••164KB
4334
128
12
Equipped
internal
bit
8-bit
8-bitclock
byte
16-bit
210 flash
timers
program
ports,
data
generalcycles
RAM
and
PEROM
with
(usually
bus
address (short
2bus
for
/serial
purpose
bit-addressable counter
external
instruction
data
(program)
(1models
2,
communication
but
byteand
interrupts.
may
have
data
wide
registers
locations have
2pointer
of8-bit
memory
each 8more,
ports).
or less).
addresses)
bits
Ex-interrupt
Timer/Counter
CPU
TxD RxD
P0 P1 P2 P3
06/01/19
2002 MuDer Jeng Edited by Syahrul 40
Inside 8051 Microcontroller
18
17
10
0F
08
07
06/01/19
2002 MuDer Jeng Edited by Syahrul 41
8051 uC
With a 12 MHz clock frequency, the 8051 could thus
execute 1 million one-cycle instructions per second
(or 500,000 two-cycle instructions per second).
06/01/19
2002 MuDer Jeng Edited by Syahrul 42
Companies Producing 8051
Table 1-2:Some Companies Producing a Member of
the 8051 Family
Company Web Site
Intel www.intel.com/design/mcs51
Atmel www.atmel.com
Philips/Signetics www.semiconductors.philips.com
Siemens www.sci.siemens.com
06/01/19
2002 MuDer Jeng Edited by Syahrul 43
8051 Family
Table 1-4:Comparison of 8051 Family Members
06/01/19
2002 MuDer Jeng Edited by Syahrul 44
06/01/19
2002 MuDer Jeng Edited by Syahrul 45
Various 8051 Microcontrollers
8751 microcontroller
– UV-EPROM
AT89C51 from Atmel Corporation
– Flash (erase before write)
DS5000 from Dallas Semiconductor
– NV-RAM (changed one byte at a time), RTC (real-time
clock)
OTP (one-time-programmable) version of 8051
8051 family from Philips
– AD, DA, extended I/O, OTP and flash
06/01/19
2002 MuDer Jeng Edited by Syahrul 46
06/01/19
2002 MuDer Jeng Edited by Syahrul 47
Web ของ MCS-51 ททน
ท า
น สนใจ
http://www.kmitl.ac.th/~kswichit/
http://WWW.MCS51.COM/
06/01/19
2002 MuDer Jeng Edited by Syahrul 48
06/01/19
2002 MuDer Jeng Edited by Syahrul 49
thanks
to be continued …
06/01/19
2002 MuDer Jeng Edited by Syahrul 50