What is Microcontroller (MCU)?

A small computer that integrates a CPU, memory and peripherals such as timers and ADCs on one chip. It is embedded in appliances, cars and other equipment to control them. Also called an MCU.

Field: CPUs and architecture

Japanese name: マイコン(マイクロコントローラ)

What is inside an MCU

A microcontroller (MCU) puts a complete small computer on one die: a CPU core, embedded flash for the program, SRAM for working data, and peripherals that connect directly to the outside world. Typical peripherals include timers that generate PWM signals, a successive-approximation (SAR) ADC, general-purpose I/O pins, a watchdog timer and serial interfaces such as UART, SPI, I²C and CAN. Because the program is already stored on chip, an MCU starts running its firmware moments after power is applied, which suits control tasks that must be ready immediately.

Microcontroller vs. microprocessor

A microprocessor or application SoC aims at computing performance: it runs a full operating system from external DRAM and storage and needs supporting chips around it. An MCU aims at cost, size, low power and predictable real-time response, running bare-metal firmware or a small real-time operating system (RTOS) from its own memory. A single car contains dozens to over a hundred MCUs, and appliances and industrial equipment use them for motor control, sensing and user interfaces. Embedded flash is hard to integrate at fine-geometry nodes, so MRAM and ReRAM are also used for program storage.

Connecting to the real world

MCU pins can source only small currents, so loads are driven through interface circuits. A transistor switch needs a base resistor sized from (drive voltage − 0.7 V) divided by the required base current, and power devices need a gate driver that turns a few-milliamp logic signal into amperes of gate current. Without a DAC, an analog voltage can be made by low-pass filtering PWM, giving amplitude × duty cycle. When measuring through a resistor divider, divider resistance and ADC loading must be considered, or the signal buffered.

Safety mechanisms in automotive MCUs

Automotive MCUs add hardware that detects faults rather than silently misbehaving. A window watchdog resets the system if software kicks it too late or too early. SEC-DED error-correcting code (ECC) corrects single-bit memory errors and flags double-bit errors so software can enter a safe state. Clock monitors compare the main clock against an independent oscillator, and voltage monitors with their own reference detect both under- and overvoltage. Logic and memory built-in self-test (BIST) at power-up uncovers latent faults in the safety circuits themselves before driving begins.

Try it: questions about Microcontroller (MCU)

When a microcontroller produces an analog voltage by passing a PWM signal through a low-pass filter, what determines the output voltage?

  1. AThe duty cycle of the pulses (the fraction of each period that is on)
  2. BThe color of the pulses
  3. CThe memory capacity of the microcontroller
Show answer and explanation

Answer: A. The duty cycle of the pulses (the fraction of each period that is on)

Averaging a PWM signal with a low-pass filter gives an output of roughly high-level voltage × duty cycle when the low level is 0 V—about 2 V for 40% of 5 V. Resolution is set by the timer's count range, and placing the PWM frequency well above the filter cutoff reduces ripple. Since it produces analog voltages without a dedicated DAC, it is used for LED dimming, motor speed control and simple audio output, but response speed and accuracy trade off against ripple.

Positional PI control is implemented on a microcontroller, with the duty cycle of a PWM signal (0 to 100%) as the manipulated variable. Which of the following is a correct countermeasure against integral windup?

  1. AWhile the output is saturated, increase the proportional gain to get out of saturation sooner
  2. BIf the integral term is calculated in floating point no overflow occurs, so no special measure is needed
  3. CWhile the output is saturated, stop integrating if the error would deepen the saturation, or feed the difference from the limited value back into the integrator, to hold down the integral
Show answer and explanation

Answer: C. While the output is saturated, stop integrating if the error would deepen the saturation, or feed the difference from the limited value back into the integrator, to hold down the integral

The first method is conditional integration (clamping): while the output is saturated and the error would deepen the saturation, the integral is not updated. The second is back-calculation: the difference between the value calculated before limiting and the value actually output is multiplied by a coefficient and fed back into the integrator to pull the integral back. In the velocity form of PID control, which calculates the change in the manipulated variable, simply limiting the output makes windup unlikely. When calculating in integer fixed point, overflow of the integral variable itself must also be guarded against, for example with saturating arithmetic.

FAQ

What is the difference between a microcontroller and a microprocessor?

A microcontroller integrates the CPU, program memory, RAM and I/O peripherals on one chip for self-contained control tasks. A microprocessor is mainly the CPU and relies on external memory and support chips, trading cost and power for computing performance.

What does a watchdog timer do in a microcontroller?

It must be cleared periodically by healthy software; if a crash or hang lets it expire, it resets the MCU automatically. A window watchdog also treats clears that come too early as faults.

How does a microcontroller output an analog voltage without a DAC?

It generates a PWM signal and passes it through a low-pass filter, so the output averages to the supply amplitude times the duty cycle. Resolution depends on the timer count range, and ripple trades off against response speed.

Questions that mention Microcontroller (MCU) (39)

Microcontroller (MCU) appears in 41 practice questions across 13 topics, including Embedded Systems & Firmware, Automotive Semiconductors and Functional Safety, Semiconductor industry and market.

  1. Which non-volatile memory is integrated on the same chip as logic circuits to store microcontroller programs?
  2. An automotive microcontroller's memory uses ECC (SEC-DED), which can correct 1-bit errors and detect 2-bit errors. What generally happens when read data contains a 2-bit error?
  3. What is the main functional safety purpose of running logic BIST and memory BIST in an automotive microcontroller at power-up or before driving?
  4. Which is an appropriate clock-monitoring safety mechanism for an automotive microcontroller?
  5. A microcontroller's operating current is specified as "120 µA/MHz." When it runs at 16 MHz, roughly what is its operating current?
  6. To cut power on a microcontroller, what should be done with unused peripherals such as timers and UARTs?
  7. A switch alone is connected to a microcontroller input pin, with no pull-up or pull-down resistor. What can happen while the switch is open?
  8. Which is a basic setting configured when using a microcontroller GPIO (general-purpose input/output) pin?
  9. What is the input capture function of a microcontroller timer used for?
  10. On an 8-bit microcontroller, a timer interrupt increments the 32-bit variable ticks, and the main code reads ticks to compute elapsed time. Why is a wildly wrong value occasionally read?
  11. Which describes the "super loop" structure often seen in microcontroller programs without an OS?
  12. What is the main purpose of using a microcontroller's sleep mode in a battery-powered embedded device?
  13. On a small microcontroller without an MMU, what should be kept in mind about excessive stack use?
  14. When a microcontroller captures many A/D conversion results at regular intervals, what is the advantage of using DMA?
  15. You want to run a control calculation every 1 ms on a microcontroller without an OS. Which implementation is most suitable?

Books on CPUs and architecture Ad

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary