In this article we’ll look at the defining characteristics of these extremely popular ICs, and then we’ll explore the internal architecture.
If I had to choose one skill that would be the most valuable addition to any engineer’s repertoire, it would undoubtedly be proficiency in microcontroller-based circuit design.
The microcontroller has played a fundamental—I would even say dominant—role in the technological revolution that has shaped modern life. Microcontrollers are small, versatile, inexpensive devices that can be successfully implemented and programmed not only by experienced electrical engineers but also by hobbyists, students, and professionals from other disciplines.
The list of possible microcontroller applications is so long that I hesitate to even give examples. Low-cost wearables, medical equipment, high-end consumer electronics, rugged industrial devices, state-of-the-art military and aerospace systems—these adaptable, affordable, user-friendly components are a welcome addition to just about any electronic product.
This arbitrary waveform generator is one of many circuit boards that I have designed around an 8-bit microcontroller.
In this article, we'll go over the definition of a microcontroller and consider what purpose it serves in a design.
What Is a Microcontroller?
A microcontroller is an integrated circuit (IC) device used for controlling other portions of an electronic system, usually via a microprocessor unit (MPU), memory, and some peripherals. These devices are optimized for embedded applications that require both processing functionality and agile, responsive interaction with digital, analog, or electromechanical components.
The most common way to refer to this category of integrated circuits is “microcontroller" but the abbreviation “MCU” is used interchangeably as it stands for “microcontroller unit”. You may also occasionally see “µC” (where the Greek letter mu replaces “micro”).
“Microcontroller” is a well-chosen name because it emphasizes defining characteristics of this product category. The prefix “micro” implies smallness and the term "controller" here implies an enhanced ability to perform control functions. As stated above, this functionality is the result of combining a digital processor and digital memory with additional hardware that is specifically designed to help the microcontroller interact with other components.
Microcontrollers vs. Microprocessors
People will sometimes use the term “microprocessor” or "MPU" when referring to a microcontroller, but these two devices are not necessarily the same. Both microprocessors and microcontrollers function as small, highly integrated computer systems, but they may serve different purposes.
The term “processor” is used to identify a system that consists of a central processing unit and (optionally) some memory; a microprocessor is a device that implements all of a processor’s functionality within a single integrated circuit. Microcontrollers, by comparison, place greater emphasis on additional hardware modules that allow the device to control a system rather than simply execute instructions and store data.
The diagram below illustrates this concept.
Overall, using the terms "microprocessor" and "microcontroller" interchangeably is not a major problem when we’re speaking informally or when we’re trying to avoid saying the same word over and over again. However, in the context of a technical discussion, it’s important to maintain the distinction between the two concepts.
Microcontrollers vs. Digital Signal Processors (DSPs)
A digital signal processor (or "DSP") is a microprocessor that is optimized for demanding computational tasks such as digital filtering, mathematical analysis of real-time signals, and data compression. A highly sophisticated microcontroller may be able to function as a replacement for a digital signal processor, but it is still considered a microcontroller if a significant portion of its internal circuitry is intended to control, monitor, and communicate with the surrounding system.
The Elements of a Microcontroller
A microcontroller consists of a central processing unit (CPU), nonvolatile memory, volatile memory, peripherals, and support circuitry.
The Central Processing Unit
The CPU performs arithmetic operations, manages data flow, and generates control signals in accordance with the sequence of instructions created by the programmer. The extremely complex circuitry required for CPU functionality is not visible to the designer. In fact, thanks to integrated development environments and high-level languages such as C, writing code for microcontrollers is often a fairly straightforward task.
Memory
Nonvolatile memory is used to store the microcontroller’s program—i.e., the (often very long) list of machine-language instructions that tell the CPU exactly what to do. You will typically see the word “Flash” (which refers to a specific form of nonvolatile data storage) instead of “nonvolatile memory.”
Volatile memory (i.e., RAM) is used for temporary data storage. This data is lost when the microcontroller loses power. Internal registers also provide temporary data storage, but we don’t think of these as a separate functional block because they are integrated into the CPU.
Peripherals
We use the word “peripheral” to describe the hardware modules that help a microcontroller to interact with the external system. The following bullet points identify the various categories of peripherals and provide examples.
- Data converters: analog-to-digital converter, digital-to-analog converter, reference-voltage generator
This plot shows three-axis accelerometer data that I digitized using a microcontroller’s on-chip ADC.
- Clock generation: internal oscillator, crystal-drive circuitry, phase-locked loop
- Timing: general-purpose timer, real-time clock, external-event counter, pulse-with modulation
- Analog signal processing: operational amplifier, analog comparator
- Input/output: general-purpose digital input and output circuitry, parallel memory interface
- Serial communication: UART, SPI, I2C, USB
My colleague Mark Hughes designed this sensor subsystem around a 16-bit microcontroller.
Support Circuitry
Microcontrollers incorporate a variety of functional blocks that cannot be classified as peripherals because their primary purpose is not to control, monitor, or communicate with external components. They are, nonetheless, very important—they support the internal operation of the device, simplify implementation, and improve the development process.
- Debug circuitry allows the designer to carefully monitor the microcontroller as it is executing instructions. This is an important, and sometimes indispensable, method of tracking down bugs and optimizing firmware performance.
- Interrupts are an extremely valuable aspect of microcontroller functionality. Interrupts are generated by external or internal hardware-based events, and they cause the processor to immediately respond to these events by executing a specific group of instructions.
Microcontroller programs written in C are organized into functions. An interrupt causes program execution to “vector” to an interrupt service routine (ISR), and after the ISR has completed its tasks, the processor returns to the function that was executing when the interrupt occurred.
- A clock-generation module can be considered a peripheral if it is intended to produce signals that will be used outside the chip, but in many cases the primary purpose of a microcontroller’s internal oscillator is to provide a clock signal for the CPU and peripherals. Internal oscillators often have low precision, but in applications that can tolerate this low precision, they are a convenient and effective way to simplify the design and save board space.
- Microcontrollers can incorporate various types of power-supply circuitry. Integrated voltage regulators allow for on-chip generation of required supply voltages, power-management modules can be used to significantly reduce the device’s current consumption during inactive states, and supervisor modules can place the processor in a stable reset state when the supply voltage is not high enough to ensure reliable operation.
Next Articles
In this article, we defined a microcontroller as a device that consists of a small, efficient processor core combined with program memory, data memory, peripherals, and various forms of support and debug circuitry.
In the next installment of this “Introduction to Microcontrollers” series, we'll go over how to choose the right microcontroller. We'll then move into how to read a microcontroller's datasheet.