Definition

What is a microcontroller (MCU)?

A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip.

Sometimes referred to as an embedded controller or microcontroller unit (MCU), microcontrollers are found in automobile engine control systems, robots, office machines, medical devices, mobile radio transceivers, vending machines and home appliances, among other devices. They're simple miniature PCs designed to control small features of a larger component without a complex front-end operating system.

How do microcontrollers work?

A microcontroller is embedded inside of a system to control a single function in a device. It uses its central processor to interpret data it receives from its I/O peripherals. The information that the microcontroller receives is temporarily stored in its data memory, where the processor accesses it and uses instructions stored in its program memory to decipher and apply the incoming data. It then uses its I/O peripherals to communicate and take the appropriate action.

Microcontrollers are used in an array of systems and devices. Devices often use multiple microcontrollers that work together in the device to handle their respective tasks.

For example, a car has many microcontrollers that control various individual systems, such as the antilock braking system, traction control, fuel injection and suspension control. Each microcontroller communicates with the others to inform them of the correct actions. Some might communicate with a more complex central computer within the car, and others might only communicate with other microcontrollers. They send and receive data using their I/O peripherals and process that data to perform their designated tasks.

What are the elements of a microcontroller?

The core elements that make up a microcontroller are the central processing unit (CPU), memory and I/O peripherals.

CPU

Also known as a processor, a CPU is the brain of the device. It processes and responds to various instructions that direct the microcontroller's function. This involves performing basic arithmetic, logic and I/O operations. It also performs data transfer operations, which communicate commands to other components in the larger embedded system.

Memory

A microcontroller's memory stores the data that the processor receives and uses to respond to instructions it's programmed to carry out. A microcontroller has two main memory types:

  1. Program memory. This stores long-term information about the instructions that the CPU carries out. Program memory is non-volatile memory, meaning it stores information over time without needing a power supply.
  2. Data memory. This temporary data storage is used while the instructions are being executed. Data memory is volatile, meaning the data it holds is temporary and is only maintained if the device is connected to a power source.

I/O peripherals

The I/O devices are the interface for the processor to the outside world. The input ports receive information and send it to the processor in the form of binary data. The processor receives that data and sends the necessary instructions to output devices, which execute tasks external to the microcontroller.

Other elements

While the processor, memory and I/O peripherals are the defining elements of the microprocessor, there are other elements that are frequently included. The term I/O peripheral refers to a supporting component that interfaces with the memory and processor. There are many supporting components that can be classified as peripherals. Having some manifestation of an I/O peripheral is elemental to a microprocessor because it is the mechanism through which the processor functions.

Other supporting elements of a microcontroller include the following:

  • Analog-to-digital converter. An ADC is a circuit that converts analog signals to digital signals. It lets the processor at the center of the microcontroller interface with external analog devices, such as sensors.
  • Digital-to-analog converter. A DAC performs the inverse function of an ADC, letting the microcontroller's processor communicate its outgoing signals to external analog components.
  • System bus. The system bus is the connective wire that links together all components of the microcontroller.
  • Serial port. The serial port is one example of an I/O port that enables the microcontroller to connect to external components. It has a similar function to a USB or a parallel port but differs in the way it exchanges bits.
Diagram showing key microcontroller components
Microcontrollers include various components.

Microcontroller features

Microcontroller processors vary based on the application. Options range from the simple 4-bit, 8-bit or 16-bit processors to more complex 32-bit or 64-bit processors. Microcontrollers can use volatile memory, such as RAM, and non-volatile memory types, including flash memory, erasable programmable read-only memory and electrically erasable programmable ROM.

Generally, microcontrollers are usable without additional computing components. They're designed with sufficient onboard memory, as well as offering pins for general I/O operations, so they can directly interface with sensors and other components.

Microcontroller architecture is based on the Harvard architecture or Von Neumann architecture. They offer different methods of exchanging data between the processor and memory. With Harvard architecture, the data bus and instruction are separate, enabling simultaneous transfers. With a Von Neumann architecture, one bus is used for both data and instructions.

Microcontroller processors are based on complex instruction set computer (CISC) or reduced instruction set computer (RISC). CISC generally has around 80 instructions, while RISC has about 30. CISC also has more addressing modes, 12 to 24 compared to RISC's three to five.

CISC is easier to implement and uses memory more efficiently, but it can have performance degradation because of the higher number of clock cycles needed to execute instructions. RISC places more emphasis on software and provides better performance than CISC processors, which emphasize hardware. CISC has a simplified instruction set and, therefore, increased design simplicity. However, because of the emphasis RISC places on software, the software can be more complex. Which one is used depends on the application.

When they first became available, microcontrollers only used assembly language. Today, the C programming language is a popular option. Python and JavaScript are also common microprocessor languages.

MCUs feature I/O pins to implement peripheral functions, such as ADCs, liquid-crystal display controllers, real-time clocks, universal synchronous/asynchronous receiver-transmitters, timers, universal asynchronous receiver-transmitters and USB connectivity. Internet of things (IoT) sensors that gather data such as humidity and temperature are also often attached to microcontrollers.

Types of microcontrollers

Microcontrollers can be classified according to data size and architecture. Common types include the following:

  • 8-bit microcontroller. These MCUs can only transmit 8 bits of data at a given time. However, they consume less power compared to larger data sizes.
  • 16-bit microcontroller. These microcontrollers have higher clock speeds and more memory than 8-bit microcontrollers. They are two times faster than 8-bit microcontrollers.
  • 32-bit microcontroller. These high-speed microcontrollers are faster and have more processing capacity than 16-bit ones. However, their power consumption is significantly higher.

Microcontrollers use one of two architectures:

  1. Von Neumann architecture microcontrollers perform one operation at a time because there is only one internal bus to handle both memory and data.
  2. Harvard architecture microcontrollers provide high performance compared with Von Neumann ones. This is because they have separate buses for processing instructions and moving data.

Examples of microcontroller models include the following:

  • MCS-51. Intel developed this single-chip microcontroller type in 1980. It is also referred to as an 8051 microcontroller. It used CISC and the Harvard architecture and came in 8-, 16- and 32-bit data sizes. Intel stopped making MCS-51 in the early 2000s, though other chipmakers offer enhanced versions of it.
  • AVR. Atmel developed this 8-bit single-chip RISC microcontroller in 1996, using a modified Harvard architecture. It became a family of microcontrollers that was one of the first to use on-chip flash computer memory to provide program storage. Microchip Technology acquired Atmel in 2016 and continues to make AVR microcontrollers.
  • Programmable Intelligent Computer. General Instrument developed the PIC microcontroller in 1976 under the name Programmable Interface Controller. This family of microcontrollers can be programmed to carry out different tasks, such as controlling electrical processes in homes, vehicles and medical facilities.
  • Advanced RISC Machines. Arm microcontrollers are also known as Arm Cortex-M microcontrollers. These lightweight microcontrollers are used in mobile electronic devices, as well as in manufacturing settings. They are designed to be energy-efficient and suitable for a range of embedded systems. These microcontrollers are part of the Arm family of processors that Acorn Computers developed in the early 1980s.

Microcontroller applications

Microcontrollers are used in multiple industries and applications, including in home and enterprise, building automation, manufacturing, robotics, automotive, lighting, smart energy, industrial automation, communications and IoT applications in business settings.

Basic areas where microcontrollers are used include the following:

  • Digital signal processors (DSPs). One application of a microcontroller is its use as a DSP. Frequently, incoming analog signals come with a certain level of noise. Noise in this context means ambiguous values that can't be readily translated into standard digital values. A microcontroller can use its ADC and DAC to convert the incoming noisy analog signal into an even outgoing digital signal.
  • Home appliances. The simplest microcontrollers facilitate the operation of electromechanical systems found in everyday convenience items, such as ovens, refrigerators, toasters, mobile devices, key fobs, video game systems, televisions and lawn-watering systems.
  • Office machines. Microcontrollers are also common in office machines, such as photocopiers, scanners, fax machines and printers, as well as smart meters, ATMs and security systems.
  • More sophisticated applications. Microcontrollers perform critical functions in aircraft, spacecraft, oceangoing vessels and robots.
  • Medical applications. In medical scenarios, microcontrollers can regulate the operations of an artificial heart, kidney or other organs. They can also be instrumental in the functioning of prosthetic devices.

Microcontrollers vs. microprocessors

The main difference between microcontrollers and microprocessors is in the level of functionality. Microcontrollers function on their own with a direct connection to sensors and actuators. Microprocessors are designed to maximize compute power on the chip with internal bus connections rather than direct I/O to supporting hardware, such as RAM and serial ports. Simply put, coffee makers use microcontrollers; desktop computers use microprocessors.

The distinction between microcontrollers and microprocessors has become less clear as denser and more complex chips have become relatively cheap to manufacture. This trend has let microcontrollers take on more general-purpose computer functionalities.

Microcontrollers are less expensive and use less power than microprocessors. Microprocessors don't have built-in RAM, ROM or other peripherals on the chip, but rather attach to these with their pins. A microprocessor is considered the heart of a computer system, whereas a microcontroller is the heart of an embedded system.

Table comparing microcontrollers and microprocessors
Microcontrollers and microprocessors are two forms of chip technology that have key differences.

Choosing the right microcontroller

There are a few technology and business considerations to keep in mind when choosing a microcontroller for a project.

Many businesses focus on using low-cost microcontrollers. However, it's also important to consider speed, the amount of RAM or ROM provided, the number and types of I/O pins on an MCU, power consumption and development support. Be sure to ask questions such as the following:

  • What hardware peripherals are required?
  • Are external communications needed?
  • Is the device in question battery-operated, requiring a low-power MCU?
  • Are additional storage devices needed, such as a flash memory card?
  • What architecture should be used?
  • What sort of community and resources are available for the microcontroller?
  • What is the market availability of the microcontroller, and what are potential alternatives?

Embedded system technology is crucial to the success of IoT. Learn more about how IoT and embedded systemst work together.

This was last updated in August 2024

Continue Reading About What is a microcontroller (MCU)?

Dig Deeper on Internet of things networking

CIO
Security
Networking
Data Center
Data Management
Close