What Is a Microcontroller? the Defining Characteristics and Architecture of a Common Component
Total Page:16
File Type:pdf, Size:1020Kb
4/5/2019 What Is a Microcontroller? The Defining Characteristics and Architecture of a Common Component What Is a Microcontroller? The Defining Characteristics and Architecture of a Common Component March 25, 2019 by Robert Keim (/author/robert-keim) 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 (https://www.allaboutcircuits.com/projects/high-speed-waveform-generation-with-an- mcu-and-a-dac/) is one of many circuit boards that I have designed around an 8-bit microcontroller. https://www.allaboutcircuits.com/technical-articles/what-is-a-microcontroller-introduction-component-characteristics-component/ 2/8 4/5/2019 What Is a Microcontroller? The Defining Characteristics and Architecture of a Common Component 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. https://www.allaboutcircuits.com/technical-articles/what-is-a-microcontroller-introduction-component-characteristics-component/ 3/8 4/5/2019 What Is a Microcontroller? The Defining Characteristics and Architecture of a Common Component 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. https://www.allaboutcircuits.com/technical-articles/what-is-a-microcontroller-introduction-component-characteristics-component/ 4/8 4/5/2019 What Is a Microcontroller? The Defining Characteristics and Architecture of a Common Component 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 (https://www.allaboutcircuits.com/technical- articles/what-are-integrated-development-environments/) and high-level languages such as C (https://www.allaboutcircuits.com/technical-articles/introduction-to-the-c-programming- language-for-embedded-applications/), 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 (https://www.allaboutcircuits.com/technical-articles/how- to-write-assembly-basic-assembly-instructions-ARM-instruction-set/) 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 https://www.allaboutcircuits.com/technical-articles/what-is-a-microcontroller-introduction-component-characteristics-component/ 5/8 4/5/2019 What Is a Microcontroller? The Defining Characteristics and Architecture of a Common Component This plot shows three-axis accelerometer data (https://www.allaboutcircuits.com/projects/gathering-and-analyzing-a- robots-accelerometer-data/) that I digitized using a microcontroller’s on-chip ADC. Clock generation: internal oscillator (https://www.allaboutcircuits.com/technical- articles/choosing-the-right-oscillator-for-your-microcontroller/), crystal-drive circuitry, phase-locked loop (https://www.allaboutcircuits.com/technical-articles/what-exactly-is-a- phase-locked-loop-anyways/) Timing: general-purpose timer, real-time clock, external-event counter, pulse-with modulation (https://www.allaboutcircuits.com/technical-articles/turn-your-pwm-into-a- dac/) Analog signal processing: operational amplifier (https://www.allaboutcircuits.com/textbook/semiconductors/chpt-8/introduction- operational-amplifiers/), analog comparator Input/output: general-purpose digital input and output circuitry, parallel memory interface Serial communication: UART (https://www.allaboutcircuits.com/technical-articles/back- to-basics-the-universal-asynchronous-receiver-transmitter-uart/), SPI (https://www.allaboutcircuits.com/technical-articles/spi-serial-peripheral-interface/), I2C (https://www.allaboutcircuits.com/technical-articles/introduction-to-the-i2c-bus/), USB (https://www.allaboutcircuits.com/projects/communicating-with-an-efm8-microcontroller- via-usb/) https://www.allaboutcircuits.com/technical-articles/what-is-a-microcontroller-introduction-component-characteristics-component/ 6/8 4/5/2019 What Is a Microcontroller? The Defining Characteristics and Architecture of a Common Component My colleague Mark Hughes designed this sensor subsystem (https://www.allaboutcircuits.com/projects/how-to-design- super-simple-sensor-system-PCB-industrial-applications/) 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