
The period between 1970 and 1980 saw an explosion in microprocessor technology. The room-sized computers of the 1950's and 1960's were fast being replaced with vastly smaller and more reliable LSI chips. These 4 and 8 bit microprocessors were a giant step for the computer industry, and their impact is still being felt today.
Following these 4 and 8 bit microprocessors were the vastly more expensive 16 and 32 bit architectures. Usually reserved for supercomputer and minicomputer applications, they were high power, high cost devices which required hundreds of support chips to operate.
At the time, all such microprocessors required support chips such as SRAM, ROM, I/O, and glue logic. The concept of "single-chip" operation did not exist. These chips had the address/data/control bus structure, and resultingly could not operate on their own.

Figure 1: Block diagram of a typical microprocessor-based system
Modern microprocessors still retain this RAM/ROM/IO structure along with data and address busses. This configuration allows the most expandability and allows the highest performance when designing large systems. However, in the realm of embedded systems, a new trend in processor design has developed, called the microcontroller.
With so many manufacturers now producing microcontrollers with hundreds of different features and design styles, it can be difficult to choose the right microcontroller for your application. The following sections of this application note shall introduce the terminology and features common to most microcontrollers, and then each of the major microcontroller families and specific controllers from various manufacturers shall be discussed.
The main CPU architecture is actually less of an issue with microcontrollers as opposed to microprocessors, but it is still important. Microprocessors and microcontrollers are usually very similar, and internally they can be identical, but microcontrollers offer a few key advantages over microprocessors. First, microcontrollers nearly always have some sort of on-chip RAM or ROM, eliminating the need for external memory chips. Since microcontrollers don't often need to access memory, microcontroller pins can be dedicated for other functions such as I/O pins, serial ports, and application specific pins. Microcontrollers are generally designed with a static HCMOS process, which means that its clock rate can be varied anywhere from DC to their top speed, without a hitch. Most microprocessors, however, cannot function properly until a minimum clock rate is reached. The static HCMOS approach allows for extremely low-power operation.
The first microprocessors had a 4 bit architectures, which means that 4 bits was the typical width of data that the processor could deal with. 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.
The most common CPU architecture by far is still 8 bit. The typical 8 bit microprocessor has an 8 bit wide data bus and a 16 bit wide address bus. This means that 8 bit microprocessors can directly access 2^16 or 65536 memory locations for a 64 kbyte total memory space. This can be expanded with glue logic, but most of the time an 8 bit system does not need much more than 64 kbytes. However, 8 bit microcontrollers generally have on-chip RAM and ROM, so the rules change slightly. While generally still limited to 64 kbytes of total memory, new approaches to microcontroller design can expand or contract this limit according to how it was designed. For example, many new microcontrollers employ the Harvard architecture, which means that the memory spaces dedicated for programs are physically separated from the data memory spaces. This is different from the Von Neumann architecture (which is still much more common) which keeps program and data spaces within the same area (a "linear memory space"). Harvard architecture allows for simultaneous access to both data and program memory in a single cycle, allowing faster execution speeds. 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 no user penalty. 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).
Besides a shift towards the Harvard architecture, another (more important) trend in microcontroller design is designing with RISC (reduced instruction set). In the past, microprocessor instructions have been CISC (complicated instruction set) which means that each instruction that the microprocessor executes performs a relatively complex function. These instructions generally take more than a single clock cycle because of their complexity. The RISC idea is to use simpler instructions but execute them faster (usually in a single cycle), with a penalty in program size because each instruction does less. While in-theory RISC is a good idea, it is generally never used, even in fast 32 and 64 bit microprocessors. A successful "middle ground" between RISC and CISC has been reached, and generally this is employed. Even though RISC processors are supposed to have fewer instructions than a comparable CISC processor, most of the time a RISC processor will have more instructions! Modern RISC architectures usually employ a "register to register" scheme. The typical CISC processor may have between 3 and 8 internal registers which instructions can use, but modern RISC architectures use between 16 up to 256 registers, each individually accessible by every instruction. With so many registers, data and operands can be kept within the processor and can reduce the number of off-chip memory accesses, which are usually much slower, and this results in a vast speed improvement. Even though these RISC instructions can be nearly as complex as a CISC instruction, they suffer no loss in speed because each RISC instruction takes an equal number of clock cycles. This means that instructions can be prefetched into an "instruction queue" and decoded before the current instruction is even finished. This technique is called pipelining and can increase the speed of execution by as much as ten times, depending on processor speed and other factors. Since RISC instructions can be pipelined, it seems as though a RISC instruction executes in a single clock cycle even though it really doesn't, since RISC instructions are executed in a parallelized fashion. CISC instructions are usually never pipelined because each instruction requires vastly different execution times, and coordinating these execution lengths is impractical.
While 8 bit microcontrollers currently dominate the market, 16, 32, and even 64 bit microcontrollers are slowly 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. Often times 16 bit microcontrollers are simply enhanced versions of an 8 bit architecture, 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 and low power operation are required. These advanced architectures have been modified from their microprocessor cousins to allow for very low power consumption, excellent I/O expandability, reduced chipcount, 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.2.2 Input/Output
Without a convenient way for microcontrollers to communicate with and control the outside world, they would have limited usefulness. The most common Input/Output device found on microcontrollers are "I/O Ports." These ports are collections of pins brought out to the microcontroller's chip package, usually 8 pins for each port. Within the microcontroller's configuration registers (which are most often just specialized memory locations within the microcontroller's memory space), the user can configure these port pins to be inputs, outputs, bi-directional, or some other combination. 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.
In addition to input/output capabilities of port pins, when configured as inputs an I/O port pin can also be configured to be high impedance or have internal pullups. When configured as a high impedance input, the pin is electrically disconnected from the driving source, and only senses the voltage level as high or low. However, configuring an input to have internal pullups means that if the driving source is somehow disconnected, the pin will assume a high level. This saves the user from adding an external pullup to the circuit, for example in with a momentary switch. The internal pullup resistor is generally of very high value 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 depending on the microcontroller and the particular part # within a microcontroller line. Microcontrollers can have as little as 5 all the way up to 100+ pins dedicated to I/O. The number of dedicated I/O pins is often directly dependant on the microcontroller's package (see the section on packaging below). The pins can also vary in terms of their individual drive capability, often times a pin can sink/source enough current to drive an LED. However, obviously a low power microcontroller with 100 I/O port pins cannot all be driving individual LED's, it will overload the chip. The microcontroller's datasheet usually lists detailed specifications on the drive capability of each of its I/O ports.

Figure 2 shows the pinout of the MC68HC11 E9 Series controller. The controller has 5 ports, PA through PE. Not all of the ports are 8 bit, notice how port D only has 6 lines, PD0 through PD5. Each of the port pins can be configured as inputs or outputs via a configuration register. Also notice how all of the port pins also have alternate functions such as address lines, data bus lines, serial ports, PWM, etc. More on pin sharing and peripherals will be discussed later in this application note.
2.2.3 Microcontroller Clock
The clock speed of a microcontroller (obviously) is a measure of performance, but you can generally never compare clock speeds across microcontroller families. For example, an Intel 8051 microcontroller running at 30 Mhz is actually slower than an Atmel AVR running at 10 Mhz. The reason for this is because microcontroller's instruction cycle may be more than a single clock cycle... It can take nearly 12 clock cycles for an 8051 to complete an instruction, whereas an AVR (a pipelined RISC-type controller) executes one instruction per clock cycle. And there are other architectures such as the DEC Alpha and the Pentium II which execute more than one instruction per clock cycle, but these are high end microprocessors. Microcontrollers have a while before they will reach this complexity and power.
How is the microcontroller clock generated? There are usually three different methods... Internal clock oscillator, internal crystal driver, and external clock source. Many new microcontroller families now have an option to use an internal clock oscillator. This oscillator is usually a simple RC pair, and it is used when the lowest power operation is needed. Since it is not a crystal based oscillator, it is not very accurate, and the clock can vary as much as 50% depending on the ambient temperature and supply voltage level.
Microcontrollers with an internal RC oscillator option can usually also be reprogrammed to allow for an external crystal. The controller will usually have two pins, often labeled "XTAL1" and "XTAL2", and you simply connect a quartz or ceramic crystal across these pins. The internal crystal clock driver of the microcontroller will then generate the signals and timing necessary to bring this crystal into oscillation. Similarly, most microcontrollers also allow the use of an external clock source. This is simply a pin which allows a TTL-level 50% duty cycle clock source to be inputted. This clock source is easily generated with a commercially available single-chip TTL oscillator. These latter two options, external crystal or external TTL clock source, are necessary when timing dependant operations are needed. A crystal is far more accurate than a simple RC oscillator, and will often not vary more than 0.00002%.

One problem with microcontroller clocks is the electromagnetic interference generated. As mentioned before, an Intel 8051 microcontroller often allows clock frequencies of up to 30 Mhz. More advanced microcontrollers like the NEC VR series can go up to 133 Mhz. At such high clock frequencies, small parasitics in the printed circuit board design or small capacitances can wreak havoc on this clock. Mysterious and "random" crashing of the controller can result if the system is not properly designed. Worst still, the controller or PCB can start radiating like an antenna, and cause interference with other nearby electronics.
One common solution to this problem is the use of on-chip clock multiplying circuitry. Many microcontrollers now use internal PLLs (phase locked loops) to multiply the incoming clock frequency up to a higher level. This way, lower frequency external clocks can be used while still retaining a high internal frequency. This can drastically reduce the radiated energy and parasitics generated by high frequency external clocks. While generally only common on more advanced, higher-frequency microcontrollers, internal PLLs are now seen in a few 8-bit microcontroller families such as the Texas Instruments TMS370. In addition, very high frequency crystals are not practical to construct so PLLs must be used in these systems (such as with high end Pentium processors).
As stated above, most microcontroller's are designed for static operation. Therefore the microcontroller's clock can be stopped even during mid-cycle, and it will still operate properly when the clock starts back up. Most microprocessors do not allow this.
2.2.4 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, and (obviously) ROM stays present even during power outages.
Microcontrollers usually do mundane tasks such as control microwaves or answering machines, so generally they do not contain very much on-chip SRAM. 64 to 512 bytes of SRAM is generally all that's included. Many microcontrollers do not even contain any on-chip SRAM, they rely on the controller's registers and accumulators for temporary storage.
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.2.5 External Memory Interface
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.

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.2.6 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.2.7 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.2.8 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.

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.

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.2.9 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.
2.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.
2.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.
2.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...
2.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.
2.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.
2.3.7 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.
2.3.8 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.
2.4.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.
2.4.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.
2.4.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.
2.4.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.
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.
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.
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.
[To Do: Excel/HTML Table of Microcontrollers]
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.