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 vehicles, robots, office machines, medical devices, mobile radio transceivers, vending machines and home appliances among other devices.
A microcontroller's processor will vary by application. Options range from the simple 4-bit, 8-bit or 16-bit processors to more complex 32-bit or 64-bit processors. In terms of memory, microcontrollers can use random access memory (RAM), flash memory, EPROM or EEPROM. Generally, microcontrollers are designed to be readily usable without additional computing components because they are 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 can be based on the Harvard architecture or von Neumann architecture, both offering different methods of exchanging data between the processor and memory. With a Harvard architecture, the data bus and instruction are separate, allowing for simultaneous transfers. With a Von Neumann architecture, one bus is used for both data and instructions.
Microcontroller processors can be based on complex instruction set computing (CISC) or reduced instruction set computing (RISC). CISC generally has around 80 instructions while RISC has about 30, as well as more addressing modes, 12-24 compared to RISC's 3-5. While CISC can be easier to implement and has more efficient memory use, it can have performance degradation due to the higher number of clock cycles needed to execute instructions. RISC, which places more emphasis on software, often provides better performance than CISC processors, which place more emphasis on hardware, due to its simplified instruction set and, therefore, increased design simplicity, but because of the emphasis it places on software, software can be more complex. Which ISC is used varies depending on application.
When they first became available, microcontrollers solely used assembly language. Today, the C programming language is a popular option.
MCUs feature input and output pins to implement peripheral functions. Such functions include analog-to-digital converters, liquid crystal display (LCD) controllers, real-time clock (RTC), synchronous/asynchronous receiver transmitter (USART), timers, universal asynchronous receiver transmitter (UART) and universal serial bus (USB) connectivity. Sensors gathering data related to humidity and temperature among others are also often attached to microcontrollers.
Types of microcontrollers
Common MCUs include the Intel MCS-51, often referred to as an 8051 microcontroller, which was first developed in 1985; the AVR microcontroller developed by Atmel in 1996; the programmable interface controller (PIC) from Microchip Technology; and various licensed ARM microcontrollers.
A number of companies manufacture and sell microcontrollers, including NXP Semiconductor, Renesas Electronics, Silicon Labs and Texas Instruments.
Microcontrollers are used in multiple industries and applications, including in the home and enterprise, building automation, manufacturing, robotics, automotive, lighting, smart energy, industrial automation, communications and internet of things (IoT) deployments.
The simplest microcontrollers facilitate the operation of electromechanical systems found in everyday convenience items, such as ovens, refrigerators, toasters, mobile devices, key fobs, video games, televisions and lawn-watering systems. They 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 microcontrollers perform critical functions in aircraft, spacecraft, ocean-going vessels, vehicles, medical and life-support systems, and robots. In medical scenarios, microcontrollers can regulate the operations of an artificial heart, kidney or other organ. They can also be instrumental in the functioning of prosthetic devices.
Microcontrollers vs. microprocessors
The distinction between microcontrollers and microprocessors has gotten less clear as chip density and complexity has become relatively cheap to manufacture and microcontrollers have thus integrated more "general computer" types of functionality. On the whole, though, microcontrollers can be said to function usefully on their own, with direct connection to sensors and actuators, where 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.
Microcontrollers are less expensive and use less power than microprocessors. Microprocessors do not have built in RAM, read-only memory (ROM) or other peripherals on the chip, but rather attach to these with their pins. A microprocessor can be considered the heart of a computer system, whereas a microcontroller can be considered the heart of an embedded system.
Choosing the right microcontroller
There are a number of technology and business considerations to keep in mind when choosing a microcontroller for a project.
Beyond cost, it is important to consider the maximum speed, amount of RAM or ROM, and number or types of I/O pins on an MCU, as well as power consumption and constraints and development support. Be sure to ask questions such as:
- What hardware peripherals are required?
- Are external communications needed?
- What architecture should be used?
- What sort of community and resources are available for the microcontroller?
- What is the market availability of the microcontroller?