Author's Note and Disclaimer, September 2002:

This document has been somewhat updated from its original version on the ECE 482 course website from the Spring of 1998 at Michigan State University. The embedded microcontroller market has changed significantly over the last few years, and even at the time, this document was never meant to be a comprehensive survey of microcontroller technology. Moreover, it was originally written over the course of about 8 hours, so don't sue me if this document makes unjusfied claims or factual errors =). Frankly, it needs a complete update and overhaul for it to remain useful.

-Mel Tsai, mtsai@eecs.berkeley.edu. Go back to my home page.

 

Application Note:

Choosing a Microcontroller for Embedded Systems Applications

Mel Tsai
April 12, 1998

Version 1.01

Abstract

Today's microcontrollers are fast, cheap, and consume considerably less power than their microprocessor cousins from the 1980's and early 1990's. With the wide variety of microcontrollers available from over 25 manufacturers, it can be difficult to keep up with the technology, market, and terminology involved with the world of embedded microcontrollers. The purpose of this application note is to provide a background and introduction to microcontrollers and to "bootstrap" those faced with the challenge of finding and using a microcontroller in their own embedded system. This application note assumes readers have a very basic knowledge of electronics, programming, and computer architecture.

1. Introduction

Only a few years ago, anemic 4- and 8-bit microcontrollers dominated the embedded controller world. With today's major advances in integration, however, designers now have more choices than yesterday's simple microcontrollers. The period between 1970 and 1990 saw an explosion in processor technology. The room-sized computers of the 1950's and 1960's were being replaced with vastly smaller, faster, and more reliable chips.

Although 8-bit microprocessor architectures have dominated since the 80's (at least in terms of market volume), the late 1980's brought a new crop of 16- and 32-bit architectures. Usually reserved for supercomputer and minicomputer applications, they were high cost devices with large power requirements. They usually required numerous support chips to operate as a complete system, making them unsuitable for the applications where simpler 8-bit architectures were ideal. At the time, compete systems (including RAM, ROM and Input/Output) based on 8-bit architectures could be integrated onto a single low-power chip. In essence, the microprocessor system architecture of Figure 1 (below) could be integrated onto a single chip.

 Figure 1: High-level diagram of a typical microprocessor-based system

With some small differences, modern microprocessor-based systems still retain this RAM/ROM/IO structure. Throughout this document, a "microcontroller" will refer generally to a microprocessor that integrates memory and I/O onto a single-chip.

2.  Microcontroller Overview

2.1 Microcontrollers

Microcontrollers were developed out of the need for cheap, small, and low power systems. Microcontrollers typically do not have the expandability or performance that microprocessors have. They are designed with embedded control and consumer applications in mind. These applications include data logging, appliances, automatic braking systems (ABS), personal electronics such as walkmans and digital watches, etc. At one time, these and other similar tasks were performed by discrete logic devices, custom-designed ICs, and analog components. These days, it is far more economical to use a cheap and versatile microcontroller. Microcontrollers allow greater flexibility, allows software to be updated later in the design phase, and do not suffer from long design cycles. These are the primary reasons why a modern car contains as many as 80 microcontrollers - one is introduced for every task that requires control or monitoring, and microcontrollers are the most economical solution (i.e. compared to a developing a new ASIC for each task).

With so many manufacturers now producing microcontrollers with different sets of features and performance, it can be difficult to choose the right microcontroller for your application. The following sections of this application note introduce the terminology and features common to most microcontrollers, and then each of the major microcontroller families from various manufacturers will be introduced.

2.2 Architecture

Microcontrollers are usually composed of a core CPU that has been "wrapped" with RAM, ROM, peripherals, and general-purpose I/O ports. Take away the wrapping and it looks like a microprocessor. Because a microcontroller often contains all the memory it needs, they will sometimes not bring its address and data bus pins (which can be as many as 64 pins) out to the chip level. This is a significant advantage, because it is usually desirable to use microcontrollers with small packages and the smallest number of pins that are required to get the job done. In addition, eliminating the external address and data bus pins allows more of its external pins to be dedicated to functions such as general-purpose I/O, peripherals (such as serial ports, A/D converters, etc.), and application-specific pins.

In order to reduce power consumption, microcontrollers are usually designed with a static CMOS process. This means that its clock (the signal that drives the operation of the core CPU) can be completely stopped at any time. Once stopped, the controller operation is effectively "paused" and it consumes almost zero power. Many microprocessors, however, are designed in a dynamic process and cannot function properly until a minimum clock rate is reached.

The first microprocessors had a 4 bit architectures, which meant that 4 bits was the maximum natural data width that the processor could handle (although greater precision could be achieved at the expense of more instructions). While still relatively common, 4 bit microprocessors and microcontrollers offer little or no cost advantage over 8 bit offerings, so only a select few markets and manufacturers still use 4 bit architectures.

8-bit architetures are still the dominant architecture for microcontrollers, especially in terms of global parts shipments (Author's note 2002: not sure if this is still true!). The typical 8-bit microprocessor has an 8-bit data bus and a 16-bit address bus. This means that most 8-bit microprocessors can directly access 2^16 memory locations, or 64 kilobytes of memory. This can be expanded with additional circuitry and software, but for most applications an 8-bit system does not require more than 64 kilobytes.

Almost all ,icroprocessor architectures of the 1980's used a Von Neumann architecture, which essentially means that instructions and data are kept in the same memory space. However, a new approach implemented by many microcontrollers is the Harvard architecture, where memory is fundamentally split between instructions (i.e. where programs are stored) and data (i.e. sensor data and temporary variables). Thus, a Harvard architecture allows for simultaneous access to both data and program memory in a single cycle, which generally allows for faster execution of programs. This comes at a cost though, such as increased complexity and more expensive external interfaces, but generally such things are all done on-chip so there is little penalty at the system level. Many new microcontrollers and most of today's latest Digital Signal Processors (DSPs) employ the Harvard architecture, some even expanding this technique into more three or more memory spaces (such as program, data, and I/O).

While 8 bit microcontrollers currently dominate the market, 16, 32, and even 64 bit microcontrollers are taking over. Today's 16-bit microcontrollers offer higher performance/cost ratios than 8-bit microcontrollers, so when designing a product with upgradability in mind, using a 16-bit microcontroller can be the logical choice. In many cases, a 16-bit microcontroller from a certain vendor is simply an enhanced versions of their 8-bit offering, allowing for backward compatibility and little loss in software investment when upgrading.

With the ever decreasing costs involved with producing VLSI chips, 32 and 64 bit microcontrollers are now cost effective enough to include in even small systems, especially when very high performance is required. These architectures have been modified from their microprocessor cousins to allow for very low power consumption, excellent I/O expandability, lower system-level chip count, and often include various features such as on-chip LCD and DRAM controllers. These next generation microcontrollers are the heart of modern consumer electronics such as PDAs, digital cameras, and many other devices.

2.3 Input/Output Features

Without a convenient way for microcontrollers to communicate with and control the outside world, they would have limited usefulness. The most common communication/control mechanism is through input and output (I/O) ports. I/O ports are collections of pins brought out to the microcontroller's chip package, often 8-pins for each port. Typically, by configuring a microcontroller in software (through its configuration registers), a programmer can configure each pin (of each port) to be either an input, output, or bi-directional. For example, if you wanted to be able to turn on and off 4 LED's in addition to receiving the input from 4 switches, you could configure an 8-bit microcontroller port to have 4 pins as inputs and 4 pins as outputs, and simply wire it up accordingly. Configuring the port is usually accomplished by writing to a data direction register for that port, and the actual port data can be written or read via the port's data register. Of course, every microcontroller is different, and each will have their own specialized way of controlling and configuring I/O port pins.

When a pin has been configured as an input, there is sometimes an option to configure it as a high impedance input or to have internal pullup capability. When configured as a high impedance input, the pin is electrically disconnected from the driving source, and only senses the voltage level as logic "high" (i.e. 3.3 volts) or "low" (i.e. zero volts). However, configuring an input to have internal pullups means that if the driving source is somehow disconnected, the pin will assume a high logic level. This saves the system designer from adding an external pullup to the circuit, for example when implementing a keyboard interface (which is usually a matrix of momentary switches). The internal pullup resistor is generally of very resistance, so that even weak external driving sources can overcome the pullup.

The number of I/O port pins available on a microcontroller can vary widely. Microcontrollers can have as little as 5 to as many as 100+ pins dedicated to I/O. The number of dedicated I/O pins is usually directly dependant on the microcontroller's package (see the section on packaging below). Larger packages have more pins, and thus more pins are available for I/O. The pins can also vary in terms of their individual drive capability. For example, some types of pins can sink or source enough current to drive an LED directly. The microcontroller's datasheet usually lists detailed specifications on the drive capability of each of its I/O pins and ports.

Figure 2: Pinout of the Motorola 68HC11 E9 Series Microcontroller

SOURCE: Motorola 68HC11 Family Reference Manual

Figure 2 shows the pinout of the MC68HC11 E9 Series microcontroller. The controller has four 8-bit ports (PA, PB, PC, and PE) and one 6-bit port (PD). On this microcontroller, each of the port pins can be configured as inputs or outputs via a configuration register. Also notice how all of the port pins have "alternate" functions, such as address pins, data bus pins, serial ports, PWM peripheral pins, etc. More on pin sharing and peripherals is discussed later.

2.4 Clocking

The clock rate of a microcontroller determins the speed at which it can execute instructions. This speed is roughly proportional to performance, but this can be misleading. For example, an Intel 8051 microcontroller running at 30 MHz is actually slower than an Atmel AVR running at 10 MHz. This is because some architectures require several clock cycles to execute a single instruction, effectively making its instruction cycle rate much lower than its overall clock rate. On average, an Intel 8051 requires nearly 12 clock cycles to execute a single instruction, whereas an AVR (with its pipelined RISC architecture) executes one instruction per clock cycle.

Physically, there are several ways in which a system architect can generate the clock for a microcontroller. When the clock does not have to be accurate and the lowest power consumption is required, many microcontrollers include an on-chip RC oscillator which drives the CPU clock. When higher clock accuracy (or when there is no on-chip RC oscillator) is needed, an external crystal resonator or some other clock source can be used. A microcontroller usually has two pins, often labeled "XTAL1" and "XTAL2," at which you connect a quartz or ceramic crystal across these pins. The internal clock oscillator of the microcontroller will then generate the signals and timing necessary to bring this crystal into oscillation. Quartz crystals and ceramic resonators are usually highly accurate (i.e. more accurate than a watch), so time-sensitive applications can be easily programmed on a microprocessor with such oscillators.

Figure 3: Typical external crystal connection to a microcontroller

SOURCE: Atmel AVR 90S1200 microcontroller datasheet

Crystal-based oscillators do not support very high frequencies, or are prohibitively expensive at high frequencies. So, when a microcontroller requires a vary high clock rate (i.e. higher than 30 MHz), a common solution is to include an on-chip phase-locked loop (PLL) which effectively multiplies an external clock by some factor. This is how almost all high-speed clocks in desktop PCs are implemented. Most fast microcontrollers include an on-chip PLL.

2.5 On-Chip Memory

On-chip memory is the most important distinguishing factor when differentiating between microcontrollers and microprocessors (which generally don't have any on-chip memory). On-chip memory is a very important consideration when choosing a microcontroller, and there are many different options available to designers.

There are two main types of on-chip memory present in microcontrollers: SRAM and ROM. SRAM is used for temporary storage and its contents will be erased when the power is removed. In contrast, the contents of ROM remain intact until purposely reprogrammed (if the ROM is erasable or reprogrammable).

Microcontrollers usually do mundane tasks such as control microwaves, log data, or control answering machines, so they often do not include very much on-chip SRAM. 64 to 512 bytes of SRAM is generally all that's included. Actually, some microcontrollers do not contain SRAM at all; they rely on internal data registers and accumulators for temporary storage.

<stopped here>

On-chip ROM is a much more pressing consideration. When designing for high volume applications, masked-ROM is most common. Masked-ROM is programmed at the factory, and is used when the programmed code is matured to the point where designers know there is no bugs in it. Masked-ROM cannot be used for low volume or prototype production runs, because it is only economical in very high volume parts.

For lower volume or prototype applications, One-Time Programmable ROM (OTP ROM) is the most common. OTP is a type of EPROM that can only be programmed once. It is generally not suited for program development because every time a program is changed, a totally new OTP part must be programmed and the old one must be thrown away. With a $10 OTP microcontroller, this can become very expensive. However, manufacturers have other options. Internally, OTP ROM is often exactly the same as UV EPROM, but they do not include the clear window on the top of the chip so that UV rays can be used to erase the memory array. Adding this clear-window on top of the chip is an expensive process, and this is why OTP microcontrollers are cheaper. Therefore, many manufacturers of OTP microcontrollers also sell a windowed version of the same microcontroller that can be programmed and erased hundreds of times with UV light. However, since the manufacturer does not sell many of these windowed development parts, expect these controllers to cost 10 times more than the equivalent OTP version.

The single most important development in microcontroller technology of the past 10 years has been flash memory. Flash ROM was primarily developed at Intel during the mid 1980's, and it has now taken over the solid-state memory market. Flash memory has the advantages of EPROM, but gets rid of some of its key disadvantages. For example, flash memory can be erased electronically without the use of UV light. However, flash memory generally only be programmed and erased in blocks as opposed to individual bytes. Block sizes can vary between 512 bytes all the way up to 64 kbytes, and this is the minimum "chunk" that can be programmed and erased at any one time. However, flash memory still retains the random access nature of SRAM and EPROM. Flash memory can also be erased many more times than UV EPROM could. The latest serial flash EPROMs available from Microchip Technologies can be programmed and erased 10 million times.

Flash memory is now making its way into microcontrollers. This was difficult initially, because flash memory requires a slightly different technique to manufacturer, so merging microcontrollers and flash arrays onto the same chip substrate was a technical challenge. However, many new microcontroller families offer flash memory. Size varies greatly across different microcontrollers, but flash is offered in sizes ranging from 1 kilobyte all the way up to 128 kilobytes in the Hitachi H8/300 series. The flash array can usually be programmed 1000 or more times, making them suitable for code development yet cheap enough for low volume production runs. Just about every microcontroller manufacturer now sees the importance of flash-based microcontrollers, and most of them are either planning or now offer flash microcontrollers.

2.6 External Memory Interfaces

Since microcontrollers are generally only used for simple applications, the chip's internal memory is often enough. However, for more complicated operations or when using advanced microcontrollers, external memory chips must be added to complete the system.

Adding external memory is exactly the same as when adding memory to a microprocessor. Memory chips require an address bus, a data bus, a chip select (CS) line, and a read/write line. The number of address bus pins determines the maximum size of external memory that can be accessed. As stated before, this maximum size can be extended via external glue logic, but it is not generally needed. Additionally, the external memory interface is often complicated when the microcontroller uses a Harvard architecture. With a Harvard architecture, external SRAM must be mapped to the data space, but program space can also be mapped to both external SRAM and ROM. The system designer must decide what configuration of external memory is ideal, and these decisions are directly dependant on the software that the controller must run. This is a prime example of how software must be codeveloped with hardware.

The details of how external memory is actually added to a microcontroller bus is beyond the scope of this tutorial, but Figure 4 shows how 64 kbytes of SRAM and 64 kbytes of ROM can be added to a (relatively advanced) Motorola 68332 32-bit microcontroller. The 68332 contains internal chip select logic (such as CSBOOT, CS0, CS1, etc.), so the controller requires no extra logic chips to interface to memory.

Figure 4: Connecting 16-bit wide RAM and ROM to a Motorola 68332 Microcontroller

SOURCE: Motorola MC68332 Device Tutorial

When large amounts of external RAM must be added, it is usually more economical to use DRAM instead of SRAM. The largest available SRAM chips are in the 512 kbyte range, and a chip like this costs over $30. However, a 2 megabyte DRAM chip can cost as little as $8. In the past, DRAM required far too much power to be used in portable embedded systems, but today's low-power EDO DRAM technologies can allow them to use even less power than a similar speed SRAM. Unfortunately though, interfacing a microcontroller to a DRAM chip is much more difficult than interfacing to an SRAM chip. DRAM chips must be periodically refreshed otherwise they will lose their contents, and this refresh mechanism can be difficult to build-into a system. However, the technologies are always improving, and many new EDO DRAM chips have "self refresh" modes that make their use transparent. In addition, many high end microcontrollers (such as the NEC VR and the Hitachi SuperH) have built-in DRAM interfaces which take the work out of interfacing to DRAMs.

2.7 Timers, Counters, Watchdog Timers, and Powerdown

Microcontrollers are at their best when performing simple, regular tasks which would have required a complex digital circuit in the past. To perform these "regular" tasks, timers and counters are vital. A timer is simply a register that is loaded by the microcontroller, whose value determines the timer period. Once loaded, the timer will then begin counting down towards zero, and when it hits zero, it will trigger an interrupt. This interrupt tells the microcontroller to do a certain predetermined task, such as "wash dishes" or something else. Timers generally count down once per clock cycle, but a timer prescaler present in most microcontrollers can divide the timer clock so that longer periods can be used. The typical 8 bit microcontroller has between one and three 8 or 16 bit timers.

A counter operates in a similar fashion to a timer. Via some internal or external trigger, a counter is loaded with a preset number of "counts." Every time the counter is triggered, say via an external switch, it will increment its counter register. Once it hits the preset value, it will trigger an interrupt. Counters also can be programmed to count backwards or triggered in a different fashion, but this method is common. Like timers, the typical microcontroller has one to three or more counters.

The concept of a watchdog timer is not new, but only within the past few years have they been incorporated into microcontroller designs. Previously, watchdog timers were specialized external chips. A watchdog timer is a software "safety net." It prevents code running on a microcontroller from crashing and causing damage to the system it is controlling. To use a watchdog timer, you load the appropriate register with the watchdog timer period. Then, once your main code begins to execute, the code must run a "watchdog timer reset" instruction before the watchdog timer runs out. If you fail to run this instruction before the timer period ends, the watchdog timer signals an error condition and auto-resets the system. An analogous situation is when you go on vacation, and your parents demand that you call them at least once per day. If you fail to call, they will think something is wrong, and come looking for you! A watchdog timer period can be anywhere from a few hundred clock cycles all the way up to 5 seconds, depending on the particular microcontroller.

In addition to the above timer-like features of microcontrollers, a modern microcontroller has a number of powerdown modes in which it can conserve power during periods of low activity. Say, for example, a microcontroller performs one task every second. Why have the controller powered all the time when it only does task per second? A microcontroller can often be programmed (via the internal timers) to sleep for a preset time period, "wake up" and perform the task, and then power back down. Microcontrollers can also be programmed so that they go into a permanent sleep mode, but can be woken up via an external trigger signal. These and other such powerdown features allow microcontrollers to use virtually zero power in embedded applications.

2.8 Serial Ports

Since the number of pins on a microcontroller is limited, serial data transmission is increasingly becoming the most popular form of communication between microcontrollers and other subsystems. Today's microcontrollers have a number of different styles and configurations of serial ports.

"I2C" is a serial transmission protocol which uses two wires for data transfer. One wire acts as a clock, the other wire is used for actual data transmission. I2C devices can be "daisy chained" to allow multiple devices to exist on the same bus, and each device can "take over" the bus and become the master. All other devices would then become the slave. The master's job is to control the clock rate and send/receive data under intelligent control. Slave devices can be "dumb" and simply respond to commands. Many new microcontrollers have I2C serial ports built-in to their design.

Three wire serial transmission protocols are the most popular form of serial communication with microcontrollers. Usually there exists a clock wire, a data receive wire, and a data send wire. One such three wire protocol is called the Serial Peripheral Interface (SPI), and it is often used to access serial-access memory chips. Instead of using 20 or more pins to interface to a memory chip, SPI allows you to only use three or four pins. This can be a life saver when using a 20 pin microcontroller!

A third form of serial communication is similar to a PC's RS232 serial port. It uses only two wires, transmit and receive, but does not use any synchronization clock line. Data is sent at specified time intervals so that synchronization is not necessary. Microcontrollers with such built-in "UARTs" have internal software-controlled baud rate generators, and with a little bit of external level-conversion, can directly interface to a PC's RS232 port or an external PC Modem or even an Infrared port.

2.9 Packaging

 A microcontroller's package determines many things about how the microcontroller is used in real-world applications. Many package styles exist, and often times the same microcontroller is offered in a number of different packages.

Common in the 1980's and early 1990's was the PDIP (Plastic Dual In-Line Package). Many microcontrollers are available in this form, and it is still heavily used (although this is changing). PDIP is offered in sizes ranging from 8 all the way up to 64 pins. PDIP is not a very dense style package, the pins/area ratio of PDIP is not as efficient as the newer package styles. Therefore it is now only used in prototype or hobbyist type applications, because it is easy to handle and put onto a homemade printed circuit board or breadboard. These days you will rarely see a PDIP in a commercial available product.

Another popular package style is PLCC (Plastic Leaded Chip-Carrier). This is a squareish type package, and is available in sizes ranging from 20 up to 80+ pins. It is characterized by its pins that wrap around the side of its package in a "spider-like" configuration. PLCC is perhaps the most common type of package for small, low-pincount microcontrollers.

The above two package styles were "through-hole" type devices, they are generally mounted on holes drilled through a printed circuit board. The other major class of packages is surface mount. A common form of surface mount package is SOIC (small outline integrated circuit) or simply "SOP" (small outline package). This package style looks like a shrunken version of PDIP, except that the pins are spaced much closer together, and the package is designed to be soldered directly to the top of a board, not via pins going through a board. SOP packages allow for very dense and efficient boards, and are generally sized from 8 to 64 pins.

Figure 5: From Left to Right:
A 32-pin PLCC chip, a 28-pin PLCC chip, and a 28-pin SOP chip

By far the most common type of package for today's latest chips is called QFP (Quad Flat Package). QFP's are surface mount devices, but its pins are spaced extremely close together in a squareish-type container. QFP's are available in extremely high pincounts, often as many as 220+ pins, and are used in everywhere from 8-bit microcontrollers all the way up to 64 bit superscalar microprocessors. QFP's generally aren't used in chips smaller than 64 pins, although such small versions exist. Most hobbyists and prototype builders cannot easily deal with QFP's because the pins are spaced so closely together, so they are forced to buy either QFP to through-hole "converters," or use the manufacturer's development board and then order their final printed circuit board from a fabrication house.

Figure 6: High Density QFP Package Examples
The DEC SA-110 (144 pins) and the SA-1100 (208 pins)

SOURCE: Digital Equipment Corporation (now Intel Corporation), http://www.intel.com

The functionality of a microcontroller is often directly dependant on the package style and pins. If an 8 bit microcontroller was placed inside a 120 pin QFP package, the designers could afford to put 10 or more 8-bit I/O ports onto the chip. However, the much higher cost of a 120 pin QFP package prohibit the controller designers from adding so many external functions, so these higher pincount packages are used in more expensive controllers. Pins available to a microcontroller become one of the most important "commodity" to controller designers. Smaller, 8-bit microcontrollers generally use 40 pin PDIPs or 50 to 60 pin PLCC packages, and the more powerful 16 and 32 bit microcontrollers generally use 100+ pin QFPs. A new trend in 8 bit controller design is to place the chip inside a 20, 16, or even 8 pin PDIP or SOP package, allowing for very small and cheap embedded systems to be constructed.

For an excellent and detailed overview of packaging technologies, click here to see the Intel Packaging Databook.

2.10 Other On-Chip Peripherals

As you can imagine, there are many other on-chip peripherals available on a modern microcontroller. Many microcontrollers contain brownout detection circuitry, which constantly monitor the supply voltage. If the supply voltage drops below a certain point, the controller will stop operation and go into a "memory retain" mode in which the internal SRAM and registers will not be erased. Even still, many microcontrollers also operate on very wide supply voltage ranges, so low voltage conditions do not develop until the voltage drops below around 2 volts. The Atmel AVR microcontroller, for example, can operate from a supply voltage of 2 volts up to 6 volts. The new crop of microcontrollers all seem to follow this trend of wide-supply range.

Also present on many microcontrollers are Analog to Digital Converters (ADCs). These devices convert external analog signals into a corresponding 8 to 12 bit digital representation. Most microcontrollers that have ADCs also allow multichannel capability, which means that they can have multiple analog sources and select between them. The 68HC11 E9 series, for example, can have up to 8 channels of analog input.

Less common are Digital to Analog converters. This feature is in less demand when it comes to embedded control applications, but it still exists. Many microcontrollers "simulate" digital to analog conversion by having a Pulse Width Modulated output (PWM), who's duty cycle (after lowpass filtering) can be adjusted to output any voltage from 0 up to Vcc.

There are many other exotic peripherals that can exist inside a microcontroller, but there are too many to list here. LCD controllers are now becoming more common in high end RISC microcontrollers, because these controllers are often used in Personal Digital Assistants which have large complex LCD screens. Integrating the LCD controller into the processor saves costs, power, and board space.

3. Popular Microcontrollers

The following is a family-level description of the most popular microcontrollers and their associated manufacturers. This list is not intended to include every microcontroller and family, but rather an overview of the more widely used varieties.

3.1 8051

 The Intel 8051 microcontroller is the "grandfather" of all modern microcontrollers. Over 10 manufacturers (including Intel) now make over 100 different varieties of 8051 microcontrollers.

The 8051 is an 8 bit microcontroller architecture based around a bit manipulation instruction set. The instruction set was designed to allow efficient setting and resetting of bits within its registers, since the majority of control applications require these types of operations. 8051 instructions are quite slow when compared to the modern RISC microcontroller architectures. Each 8051 instruction requires 12 or more clock cycles to execute, so very fast clocks are needed for an 8051 to keep up with the competition. However, since the majority of embedded control operations do not require blazing fast operation, most of the time an 8051 microcontroller can get the job done. And as an added benefit, the 8051 has been around for years and there are hundreds of mature development tools available for it. Many design engineers who first started using the 8051 back in the 1980's still use it because of familiarity. Plus, most of the time 8051 microcontrollers retain the same pinout across families and manufacturers, so using a Phillips 8051 is nearly the same as using an Intel 8051 (with subtle differences of course).

8051's run the gamut in terms of speed, upgradability, and internal memory. There are many manufacturers (such as Atmel) that now make flash memory based versions. The 8051 is based on the Harvard architecture, i.e. data memory is kept separate from program memory. The 8051 is expandable to up to 64 kbytes of program and 64 kbytes of data memory. Most of the time, however, the address and data bus pins of the 8051 are multiplexed with other pins such as the I/O ports, so adding external memory means you must give up many of the I/O ports.

8051's are generally offered in 40 pin DIP or 52 pin PLCC packages. There is not much variation across manufacturers or even within the 8051 series in terms of package pinouts. Upward compatibility was built-into the different versions of the 8051, so therefore the latest advanced 8051 from Intel can directly replace a cheap 8051 without even changing the printed circuit board. This "drop-in" replacability is rarely true of other microcontroller architectures.

Phillips also makes a new version of the 8051 called the XA (eXtended Architecture), which is a 16 bit enhanced version of the 8051. It changes the 8051 architecture to a much faster 16 bit processor, yet it still retains both software and hardware backward compatibility. The Phillips XA series controllers come with up to 32 kbytes of internal flash memory as well, and run about $25/chip.

3.2 8-Bit Motorola Controllers

Motorola sells millions of microcontrollers every year, ranging from slow 8 bit controllers all the way up to superscalar 64-bit embedded PowerPCs (which isn't really a microcontroller, but it's close!). Their most popular 8 bit controllers are based on the original MC6800 processor, one of the most successfully 8 bit microprocessors of the 1970's. Motorola has tweaked and vastly extended the MC6800 to its microcontroller versions of the 1990's, including the 6805, 68705, and most recently the 68HC11 and 68HC12.

The 68HC11 is perhaps Motorola's most popular microcontroller. It is an accumulator-based architecture, having two 8 bit registers called A and B. For 16 bit operations and arithmetic, A and B can be combined to form a 16 bit register D. The 68HC11 instruction set is predominantly a load and store [from memory] type architecture, as opposed to a register to register scheme. The instruction set is actually not very efficient, but it easily handles most control applications. Despite low clock speeds of the 68HC11 and 6805, each instruction does not take very many cycles to execute, therefore a 2 MHz 68HC11 is fast enough for most control applications. In fact, the 68HC11 doesn't even come in versions faster than 4 MHz.

Motorola has come out with a 16 bit enhanced version of the MC68HC11, called the MC68HC12. This is one of the first microcontrollers to implement fuzzy logic instructions into its architecture. Motorola also has a number of other microcontrollers and microprocessors (some of which are described below), far too many to go into.

3.3 Microchip PIC

The Microchip "PIC" is a very popular microcontroller in the hobbyist market. It is a true RISC processor, having less than 33 instructions and only a few registers. It is very cheap in small quantities, and there are flash versions available also.

PICs are used in very small, cost-sensitive applications. They use very little power during operation and have a number of sleep modes. For the smallest applications, there is even an 8 pin version of the PIC. The most popular PIC microcontrollers are 16 to 28 pins, the 28 pin version having around 24 I/O pins.

Programming the PIC is a tedious and delicate task, because the instruction set is unforgiving. There are only a few specialized registers to work with, and with so few instructions, doing even simple tasks can be a headache. While there are C cross compilers available for the PIC, you generally don't have a lot of memory to work with on a PIC so this can be impractical. This and other factors could be the reason why "true" RISC architectures are virtually never seen...

3.4 Atmel AVR

Dubbed "the PIC killer," the Atmel AVR is a new 8 bit RISC microcontroller from Atmel. Instructions within the AVR are sent to a pipeline, allowing each instruction to execute in a single clock cycle. The AVR employs a register to register scheme, with 32 internal registers to work with, each accessible with every instruction. Programming the AVR is a breeze because of its highly efficient set of 100+ instructions. With versions available up to 20 MHz, the AVR can reach 20 MIPs (mega-instructions per second) while only costing $3.00 per chip. This is 10 to 20 times faster than the fastest PIC or MC68HC11.

All versions of the AVR have internal flash memory, ranging from 1 kbyte up to 8 kbytes and up to 512 bytes of internal SRAM. The higher end versions are pin-compatible with the 8051, so they can be substituted with only a software change. The AVRs internal memory can be reprogrammed over 1000 times, making them easy for hobbyists to use and build prototypes. AVRs are available in packages up to 40 pins and with up to 33 I/O lines.

3.5 Hitachi H8

 The Hitachi H8 is a series of 8 and 16 bit controllers. H8/300's are considered "high-end" 8 bit microcontrollers, as there are versions of the H8/300 with over 133 pins, with lots of I/O and on-chip peripherals. The instruction set is highly efficient with many instructions and registers, similar to the Motorola 68k processor. The 16 bit versions of the H8 are upward compatible with the 8 bit versions, so upgrading to the more powerful 16 bit version is painless. Some versions of the H8 come with up to 128 kbytes of internal flash.

3.6 Zilog Z8, Hitachi 64180

The Zilog Z80 microprocessor was one of the most popular microprocessors of all time. It is still used in many commercial products such as TI graphing calculators, the Nintendo GameBoy, etc. Zilog designed a microcontroller version of the Z80 called the "Z8." Interestingly though, there are not many similarities between the Z80 and the Z8. The instruction set has been totally changed around, and software written on the Z80 cannot be run on the Z8.

In any case, Zilog Z8 microcontrollers come in many varieties. Most Z8's are still only available in Masked ROM or OTP, but they are slowly migrating towards flash. Z8's come in versions ranging from 20 up to 64 pins.

While not really a "microcontroller," the Hitachi 64180 is an enhanced version of the Z80 that is used in many embedded systems. The 64180 retains backward compatibility with Z80 software, and extends its memory capabilities and speed. Hitachi recently stopped producing the 64180, as Zilog now makes the Z180, a version of the Z80 which is highly similar to the Hitachi 64180.

3.7 Texas Instruments TMS370

Texas Instruments makes just about everything, so why not microcontrollers! The TMS370 is actually a very old and mature 8 bit microcontroller line, but it still easily competes with other microcontroller families. The TMS370, more than any other controller, has a highly register-to-register based architecture. The TMS370 has 128 or 256 internal registers, each accessible with every instruction. The number of registers depends on the internal SRAM, as the registers are mapped to this SRAM space.

The TMS370 comes in versions ranging from 28 up to 64 pins, and have a multitude of on-chip I/O and peripherals. TMS370's are available in OTP and Masked ROM configurations, but they also sell windowed UV-erasable parts for code development and prototyping. And as with all such microcontroller manufacturers, they offer a number of different development kits, boards, and C compilers.

3.8 Advanced Microcontrollers

While slower 8-bit microcontrollers currently dominate the market, 16 and 32 bit processors are slowly making their way into cheap mainstream electronics. Often times an order of magnitude more powerful than their 8 bit predecessors, these microcontrollers can do everything from software-based modems all the way to real-time data acquisition and image processing.

3.8.1 Motorola Coldfire and the MC683xx

 Back in the late 1970's and early 1980's, the Motorola MC68000 was one of the most superior microprocessor architectures available. It was extended through 5 generations of processors, and descendants of the 68000 are being sold in the millions every year.

In the late 1980's, Motorola decided to release a microcontroller version of the MC68000, called the MC68300. While prohibitively expensive at the time, there are now derivatives of the MC68300 which cost under $10/chip. One such microcontroller is the MC68332. It retains the advanced 32-bit 68k architecture (it is actually compatible with the advanced MC68020), yet is low power and has tons of on chip peripherals and I/O, including multichannel ADCs, a Queued Serial Module (QSM), etc. The MC68333 is a version which contains 64 kbytes of flash and 4 kbytes of SRAM. While not blazingly fast, the MC683xx series makes up for this by having the highly supported, efficient 32-bit 68k architecture.

The "Coldfire" is Motorola's latest microcontroller offering. While internally it is an advanced RISC processor, it can directly execute 68k code. This allows designs based around 68k to be easily upgraded to the Coldfire. The Coldfire operates much faster than other 68k derivatives, yet still retains low power operation and also has some I/O lines and serial controllers.

3.8.2 The ARM, NEC VR4xxx, and Hitachi SuperH

 ARM is actually a RISC based microprocessor architecture. ARM licenses their technologies to other manufacturers, who then can use ARM as the core architecture and build other features around this core. For example, DEC makes the StrongARM, an ultrafast, ultra low-power microcontroller used in applications demanding very high performance. Versions of the StrongARM offer the industry's highest performance/watt ratios for microcontrollers. StrongARMs are so powerful that 33.6 kbps modems can be implemented entirely within software on a SA-1100 controller. This is now being used in PDAs and palmtop computers where the modem is contained within software, while still retaining very good battery life.

Like the StrongARM, the NEC VR4xxx series chips are very high performance yet low power controllers. They are based upon the MIPS RISC core, which means that they are predominately a 64 bit architecture, which up until 5 years ago was reserved for workstations and supercomputers.

For the amount of power they use, the NEC VR4xxx chips are simply amazing. The upcoming NEC VR4111 processor can runs at over 100 MHz, yet only consumes 0.18 watts of power. Compare this to the 25+ watt power consumption of the typical Pentium processor, which is actually of less performance than the VR4111 (due to its superior MIPS 64-bit architecture). NEC VR4xxx chips are predominantly available in QFP packages ranging from 120 up to 220 pins, and cost anywhere from $30 up to $60 per chip.

The Hitachi SuperH is less powerful than the above two controllers, but it is gaining popularity among designers. Available in three versions (SH-1, SH-2, and SH-3), it is a RISC-like architecture which is a fundamental redesign of their 16-bit H8 series microcontroller. It offers low power operation and low cost. There is even a version of the SuperH which includes a few DSP instructions such as fast multiply and divide.

3.8.3 Embedded x86 Controllers

 Due to its use in millions of desktop computers worldwide, the x86 is arguably the most successful architecture of all time. Embedded versions of the 8086, 80386, and the 80486 have sprung up from a number of different manufacturers, including Intel.

Intel makes the 80386EX, a "microcontroller" version of the popular 386 processor. Intel took the 386 and redesigned it for lower power, static operation, while at the same time adding certain features that allowed it to function more as a stand alone chip. The original 386, however, required many other support chips to function in a complete system. Advanced Micro Devices (AMD) makes a version of the 486 called the ElanSC, in which most of an entire IBM PC motherboard is put onto a single chip, along with a 486 core. All that's required is memory, a power supply, and an LCD display and you can have an entire PC compatible 486 computer. The ElanSC is used in a few of the ultra small 486 palmtop computers, as well as many industrial PC/104 based control systems.

Intel also makes a number of 80186 and 80188 processors, which are embedded versions of the 8086 and the 8088 processors respectively. These are used heavily in thousands of different control applications and products.

3.8.4 DSP's With Microcontroller-Like Functionality

 The "ideal" microcontroller or microprocessor is a processor which combines the speed and number crunching ability of a DSP with the versatility and ease of a microcontroller. Well, there are now a select few "hybrids" that fit the bill.

Texas Instruments is the world leader in DSPs, and recently released the TMS320C2000, a fixed-point DSP series that has many microcontroller-like features such as low power operation (most DSPs are power hungry), on-chip flash, ADCs, I/O, etc. while still retaining compatibility with other DSPs in the family. There are other DSPs available from TI, Motorola, and Analog Devices that can easily be used in a microcontroller-like fashion.

4. The Complete Microcontroller System

When designing a microcontroller system, there are many more considerations than merely the choice of microcontroller. In today's world of fast and complex embedded systems, often times Field Programmable Gate Arrays (FPGAs) or Programmable Logic Devices (PLDs) must be included. These devices serve a number of different purposes, but often times they serve as combinational and sequential logic replacements, interface logic, implement various operations and functions, etc. Many of these devices are also reprogrammable on the fly, which allows the system to reconfigure itself during operation (ISP - In System Programming).

When maximum cost and performance efficiency is required, designers can also turn to microcontrollers with customizable functionality, right on the chip. Such "ASICs" (Application Specific Integrated Circuits) let designers to add their own logic elements and cells right next to the microcontroller core, allowing high performance, single-chip solutions. Costs can be drastically reduced in high volume applications using ASICs because of decreased chip count, lower power operation, greater integration, etc.

Other factors under consideration when designing an embedded system include the printed circuit board (whether to go with a single sided board all the way up to a professionally fabricated 8-layer board), multivoltage power supplies (today's chips use a combination of +5, +3.3, +3, and now even +1.8 volts for power), electromagnetic interference shielding, FCC certification, etc.

4.1 Development Tools

In the past, tools used to develop and produce embedded systems were not very sophisticated, nor did they have to be. However, in today's competitive world, the difference between a successful microcontroller and a failure is the quality of its development tools. Such tools include code assemblers, high-level language compilers and support (such as C and BASIC), integrated development environments (IDEs), debuggers, emulators, development kits, etc.

The importance of development tools has also brought about a new principle in microcontroller design. Many manufacturers now design their microcontroller architecture with the sole purpose of making it efficient for high-level languages. Since embedded system designers no longer have the time to write all their code in raw assembly, they must typically resort to C programming. Many microcontroller architectures cannot efficiently execute code written in C, because such high level languages depend on efficient memory access, multiple registers used for temporary space, etc. However, most new architectures have RISC-like designs with many registers, which allow efficient execution of C code. In fact, there are even some architectures (such as the new, ultra-powerful C6x DSP from Texas Instruments) can no longer be programmed in assembly language, you must use their C compiler (this is due to its highly parallelized internal organization)!

Third party software libraries are also becoming very important. It can be difficult to perform certain mathematical operations or functions inside a microcontroller, and this is where third-party routines play a key role. Also important are the development of new Real Time Operating Systems (RTOSs). An RTOS serves as a task manager in an embedded system, allocating processor resources to various threads of execution, keeps things in order, etc. RTOSs are typically written in C code, and can generally portable to most any microcontroller architecture.

4.2 Distributors and Pricing

Once a designer has chosen a microcontroller to use in their system, pricing and availability becomes a key issue. As with any electronic component, purchasing in higher volume allows gives the most economical pricing. Sometimes the difference between high volume and low volume pricing can be as much as 75%. It also makes a difference whether the part is to be ordered with a preprogrammed "Masked-ROM," or whether it will be OTP, flash, or ROMless (in which case external memory must be used).

In general, the cost of a microcontroller is directly proportional to its internal memory, speed, and capabilities. However, the price gap between upper range microcontrollers and low performance, small microcontrollers is becoming narrower every year. In low volume purchases, the typical 8 bit microcontroller can cost anywhere from $1.00 all the way up to $50 or $60. Yet, at the same time, the high performance, 32-bit RISC microcontrollers can cost anywhere from $20 to $100. As you can see, pricing is not always the most important issue in the design, as you generally always find a suitable controller in your price/performance range. In addition to finding a microcontroller in your price range, you must also take into consideration the cost and quality of its development tools. Microcontroller development/evaluation kits can cost as high as $2000 per board, and a C compiler or IDE can cost nearly that much as well. RTOSs and third party software libraries can also be very expensive. Such high prices often limit what individuals and students can use to develop their systems, but luckily there are nearly always cheap and/or free solutions for developing embedded systems.

When purchasing a microcontroller or any other chip, you must generally deal with a distributor. When a manufacturer produces a chip, it usually never sells the chip directly to customers or clients. It will usually set up a deal with a component distributor or a "sales representative," which then takes over the responsibility of selling the parts. A single manufacturer can sell its chips via multiple distributors, and a single distributor sells chips from multiple manufacturers.

5. Conclusion

With microcontroller technologies improving almost daily, it can be difficult to keep up with this fast changing world. Embedded systems and control is becoming a tremendous field, and issues such as creating low-power, real time systems is no longer a matter of choosing the right parts, but rather designing all aspects including hardware, software, and the top level interface, all in-parallel. Luckily, today's embedded systems designers now have a multitude of choices when designing under deadlines, price caps, and performance thresholds. With a bit of research and determination, the designer can now focus on the design, rather than parts and technologies.

 

6. References

All figures and diagrams without a "SOURCE:" identifier below it were created by the author, specifically for this Application Note.

Various information relating to specific microcontrollers and their specifications were taken from the manufacturers' respective datasheets, which are all available from their respective websites, such as those in the following list.

6.1 Microcontroller Manufacturer Links

  • Atmel, maker of the AVR RISC controller and various 8051 clones.
  • Intel, maker of a variety of microcontroller and microcontroller lines, including the 8051, StrongARM, and recently the XScale family of embedded processors.
  • Texas Instruments, maker of the TMS370 line of 8 bit controllers, as well as the world-leader in DSP technologies.
  • Hitachi, maker of the H8 and SuperH line of powerful microcontrollers.
  • NEC Electronics. Ultrafast VR4xxx line of low power processors, as well as other 8, 16, and 32 bit controllers.
  • Philips. 8051 clones and enhanced derivatives.
  • Motorola. Very popular microprocessor and microcontroller manufacturer, plus lots of cellular and wireless technologies.
  • Siemens. Manufacturer of multiple microcontrollers including various 8051 clones.
  • Microchip. Maker of the popular "PIC" line of controllers, as well as an extensive line of serial access EPROMs.
  • National Semiconductor. Maker of the "COP8" controller series, as well as an embedded version of the Intel 486.
  • ST Microelectronics. Maker of various microcontrollers and microprocessors.
  • Analog Devices. DSPs and many analog ICs.
  • Digital Equipment (DEC). The StrongARM SA-110 and SA-1110.
  • ARM. Licenses the ARM core used in many products and ASICs.
  • Advanced Micro Devices (AMD). Manufacturer of various RISC and Intel x86 clones, as well as a large line of embedded x86 derivatives.
  • Dallas Semiconductor. Specializes in low power and nonvolatile memory technologies, "smart card" devices, 8051 clones, microcontroller support chips, etc.
  • Fujitsu. DSPs and various microcontrollers.
  • Harris Semiconductor. Microcontrollers and MC6805 clones.
  • Toshiba. Makes various microcontrollers including Z80 and motorola microcontroller clones.