Sunteți pe pagina 1din 10

MICROPROCESSOR VERSUS MICROCONTROLLER

Figure 13.1 illustrates some of the similarities and differences between microprocessors
and microcontrollers. In Figure 13.1(a), the microprocessor is just one component of many
in a system containing digital and analog I/O, timers, RAM, EEPROM, etc. In Figure
13.1(b), we see that all of the components in the microprocessor-based system are
contained
within the microcontroller itself, with the exception of the D/A converter. However,
the PWM (Pulse Width Modulation) output of the microcontroller can, through a
low-pass filter, generate an analog output voltage.
The microprocessor needs an external ROM or EEPROM to store its control program.
These memories are built into the microcontroller. Thus, instead of placing a ROM
into a burner to program it, the microcontroller is placed into the burner and programmed.
In addition, glue logic is required to interface the microprocessor with its external
cuitry. None is required in the microcontroller-based system, since most of the circuitry is
already inside the microcontroller.
The instruction set of the microprocessor is more powerful than that of the microcontroller.
For example, there may be microprocessor instructions to support multitasking,
memory management, and floating-point calculations, but these instructions are not
typically
found in a microcontroller. Thus, the complexity of the application or process helps
determine whether or not to use a microcontroller.
13.4 WHY USE A MICROCONTROLLER?
As stated in Section 13.3, the difference between a microprocessor, which can do nothing
by itself, and a microcontroller is clear. Even so, the applications for microprocessor-based
systems are numerous. The popular personal computer stands out as one of the most
important
and useful applications.
But many applications do not require the impressive power of the 32-bit microprocessor
or the extensive expandability that is available on many microprocessor-based
motherboards. Applications such as Electronic Times-Square displays, credit card
readers, automatic teller machines, and others can be handled easily with the power of an
8-bit microprocessor and some external support circuitry for I/O. When this is the case, a
microcontroller becomes a suitable substitute.
The microcontroller is a good alternative to microprocessor-based systems, bundling
many of the features of the system on a single chip! For instance, one model of the Motorola
6811 microcontroller that we will be covering contains all of the following on a
single chip:
12K bytes of EPROM
512 bytes of EEPROM
512 bytes of RAM
16-bit Timer
serial I/O capability
8-channel analog-to-digital conversion
Another popular microcontroller, the Intel 8051, is similarly organized. Its internal hardware
includes RAM, EPROM, timers, interrupt circuitry, and both serial and parallel I/O.
Clearly, the microcontroller is almost a complete system by itself, containing internally
many of the most desirable functions found in a microprocessor-based system. One can
only assume that the term microcontroller was derived from the usefulness of this device
in many control applications.
One could easily argue that the microcontrollers currently available do not compare
to the powerful 32-bit microprocessors that can access billions of bytes of memory, have
powerful instruction sets that support multitasking, are optimized for multimedia processing,
and run at clock speeds upward from 2 GHz. On the other hand, it would be a
waste of technology to put a 32-bit microprocessor inside a robot arm dedicated to welding
frame joints on an assembly line or inside a credit card machine, microwave oven, or
personal
ANTOMC13.QXP.130195619/12/037:18PMPage451
452 CHAPTER 13 MICROCONTROLLERS
Data Size Microcontrollers Number of Models
8 bits M68HC05 44
M68HC08 55
M68HC11 19
16 bits HCS12 22
M68HC12 16
M68HC16 3
32 bits 68K M683XX 9
M*CORE 5
MPC500 11
ColdFire MCF5XXX 3
TABLE 13.1 Motorola 8-
/16-/32-bit microcontrollers
computer keyboard. In small, dedicated applications like these, an 8-bit microcontroller is
powerful enough to handle the job with a minimum of external circuitry. With its built-in
EEPROM and RAM, serial I/O and timer capability, and self-contained operation, why use
anything else for a small control application? It would be too expensive in terms of
component
count, layout, board space, and troubleshooting to use anything but a microcontroller.
Now that we have an exposure to the basics of the microcontroller, we can concentrate
on the specifics. Table 13.1 lists the many different types of Motorola microcontrollers.
The number of models of each type of microcontroller allows the designer to
choose the microcontroller that best fits the needs of a new system.
The differences between models include the amount of internal EEPROM and
RAM, the number of serial and parallel I/O lines, the number of timers, PWM outputs, and
A/D channels, and so on. Let us take a look at some actual devices.
13.5 8-BIT MICROCONTROLLERS
Just as important as their 16-bit and 32-bit counterparts, the 8-bit family of microcontrollers
fulfills the low-cost, medium-performance requirements for many small systems.
Table 13.2 lists the type and quantity of hardware features provided by the three 8-bit
microcontroller
families. There are many models within each family (refer back to Table 13.1)
Bus A/D
RAM ROM EEPROM Flash Serial Frequency Converter PWM
Family (bytes) (bytes) (bytes) (bytes) (channels) Timers (MHz) (channels) (channels) I/O
M68HC05 920 32768 7936 x 2 8 4 8 3 80
M68HC08 2048 25088 1024 61872 3 8 8 15 16 52
M68HC11 1024 32768 640 x 2 8 5 8 4 62
Note: All values in the table denote the maximum available feature across the family of devices.
TABLE 13.2 8-bit Microcontroller features
ANTOMC13.QXP.130195619/12/037:18PMPage452

16-BIT MICROCONTROLLERS
The three main 16-bit microcontroller families are listed in Table 13.3. Again, the type
and amount of internal support hardware (timers, serial channels, I/O, etc.) differ between
models.
One family, the 68HC16 microcontrollers, are the 16-bit enhancements of the 8-bit
68HC11 microcontroller. With 16-, 20-, and 25-MHz versions available, the 68HC16 is
designed to provide many powerful features without the need for CPU intervention, including
multichannel timers, analog-to-digital converters, and networking activities. For
example, Figure 13.3(a) shows the block diagram of the Time Processor Unit in the
68HC16. Sixteen timer channels are controlled by a Micro-engine, freeing the CPU of the
Port A PA0-PA7
PB0-PB7
PC0-PC7
IRQ
PD0-PD5
PE0-PE7
Timer system
Port B
Port C
Port D Serial interface
Port E A/D converter
V ref
Bus expansion
address
Address/data
Mode
control
EPROM
OSC
clock
Interrupt
logic
EEPROM
RAM
68HCII
CPU
FIGURE 13.2 68HC11 block diagram
ANTOMC13.QXP.130195619/12/037:18PMPage454
13.7 32-BIT MICROCONTROLLERS 455
chore. In a similar fashion, the 8-channel analog-to-digital converter in Figure 13.3(b) uses
a single Successive Approximation Register (SAR, a fast A/D converter) and analog
multiplexer
to process eight analog input channels.
The 68HC16 also provides a Controller Area Network (CAN) interface, allowing the
68HC11 to use asynchronous serial communication to exchange data with industrial and
automotive control systems at a speed of 1 Mbps.
13.7 32-BIT MICROCONTROLLERS
Table 13.4 lists the features of Motorolas four families of 32-bit microcontrollers. Each
family has architectural differences, but also provides many of the same support features
(serial I/O, A/D conversion, timers, etc.).
The computing architectures of each family are as follows:
M683XX: 32-bit CPU32 processing core
M*CORE: 32-bit microRISC Engine
MPC500: 32-bit PowerPC core
MCF5XXX: 32-bit ColdFire Version 2 core
Let us take a closer look at these powerful microcontroller families.
MC683XX Family
This family contains several different microcontroller models, each specializing in a different
area. These microcontrollers are as follows:
MC68302: Integrated Multi-Protocol Processor
MC68306: Integrated EC000 Processor
MC68331/332/336: 32-bit Microcontroller
MC68340: Integrated Processor with DMA
MC68360: Quad Integrated Communication Controller
MC68F375/376: 32-bit Microcontroller
Bus A

The heart of each of the 683xx microcontrollers (except for the 68302) is the CPU32 core, a
32-bit processing unit based on the 68000 software model and instruction set, with
additional
features from the 68010 and 68020 as well as new features specifically added for control
operations.
There are seven addressing modes (no pre-decrement or post-increment). Although
the data registers are the familiar 32-bits wide, 64-bit integer operations are provided.
M*CORE Family
The M*CORE family of microcontrollers are built around a new processing core called the
M*CORE microRISC Engine, which was designed to provide high performance with low
system power. This makes the M*CORE family suitable for battery-operated and mobile
applications.
Figure 13.4 shows a block diagram of the microRISC core. Although the load/store
architecture is 32 bits wide, instructions are fixed at 16 bits wide for fast instruction
throughput between the core and the memory system. There are sixteen 32-bit general
purpose
registers, support for arithmetic and logical operations, and a four-stage instruction
pipeline that allows most instructions to complete in one clock cycle.
MPC500 Family
For systems designed around the PowerPC architecture, the MPC500 family provides 11
models of PowerPC microcontrollers. This provides compatibility with the PowerPC
instruction set, including floating-point operations. With either 512 KB or 1 MB of flash
memory, these microcontrollers are suitable for scientific applications involving complex
operations and large control programs. See Appendix I for additional information on the
PowerPC architecture and family of processors.
MCF5XXX Family
This family of microcontrollers utilize the ColdFire Version 2 core, which contains an
enhanced
multiply-and-accumulate unit (eMAC) designed to support DSP applications. Additional
microcontroller features include DMA, I2C bus support, Ethernet, CAN, and
on-board cache.

The ColdFire Version 2 processing core is a variable instruction-length RISC architecture.


Instruction fetch and decode/execute units are pipelined and process ColdFire instructions,
which are similar to those in the 680x0 instruction set.
No matter which microcontroller you may choose for an application, it is important
to have access to support tools that you will need during development, such as a universal
programmer, C compiler, and in-circuit emulator. Many of the newer microcontrollers
have built-in debug interfaces that provide real-time debugging, assisting with
troubleshooting
and simplifying the development process. Links to these tools, as well as technical
documentation and other resources, are available on Motorolas Web site.
Introduction
This handout provides an introduction to programming an Atmel-Mega
microcontroller. It is based on the STK 500. The information provided is a
good starting point for first time students. The Atmel AVR STK500 is a starter
kit and development system for Atmel's AVR Flash microcontrollers. The
STK500 gives students a quick start to develop code on the AVR combined
with features for using the starter kit to develop prototypes and test new
designs. The STK500 interfaces with AVR Studio, Atmel's Integrated
Development Environment (IDE) for code writing and debugging.
Expansion cards are available for the different AVR sub-families and larger
devices. If you are already confident with basic ANSI C programming
(statements such as if, else, do,
While, for, main and others) and you have a basic understanding of
microcontrollers, this document should be easy to understand.

Fig: Atmel AVR STK500 starter kit

FEATURES OF STK 500


AVR Studio Operated
Serial In-System Programming
In-System Programming in External Target Systems
Parallel and Serial High-voltage Programming
RS-232 Interface to PC
Sockets for 8-, 20-, 28-, and 40-pin AVR Devices
Flexible Clocking, Voltage and Reset System
LEDs and Push Buttons for Experimentation
All AVR I/O Ports Easily Accessible through Pin Header Connectors
Spare RS-232 Driver and Connector
Upgrades are done from AVR Studio
Expansion Connectors for Plug-in Modules and Prototype Areas
Target Voltage 1.8 6.0V
Supply Voltage 9 12V

S-ar putea să vă placă și