Microcomputers and microcontrollers

What comes to mind when you hear the terms microcomputer and microcontroller? The brain inside a personal computer? The IC inside an electronic rice cooker? Something like a computer? Depending on your generation and background, the image might differ. Here, we explain the basics of what makes a microcomputer and microcontroller.


Classification
Whether you consider a device to be a computer or controller is a matter of perspective. Both devices are ICs realized on a very small semiconductor chip that methodically read, interpret, and execute programs, performing arithmetic logic operations and branching. Perhaps you can differentiate between microcomputers and microcontrollers in this way:

  1. If a device is used primarily for computing, it might appropriately be classified as a microcomputer.
  2. If a device is embedded in a product primarily as a component that controls hardware to realize product functions, it might appropriately be classified as a microcontroller. In this case, it might also be called a microcontroller unit (MCU).

In the early days, personal computers were commonly called microcomputers. However, “personal computer” soon became the standard term. Today, the terms microcomputer, microcontroller, and micro-controller unit (MCU) are often used interchangeably. For our purposes here, we will use the term microcontroller.

Embedded microcontrollers

Embedded microcontrollers are devices that are used in finished products, including most of the electronic devices we use every day. They are found in everything from home appliances to cars, industrial products, mobile devices, and medical and health equipment. Not all electronic goods employ a microcontroller, but most do thanks to the ability of microcontrollers to flexibly handle complex processes.


Microcontroller boards

A microcontroller is a semiconductor product (IC) that requires a development environment (hardware and software) to develop products that use the microcontroller. You can’t do anything with a microcontroller (IC) that you simply purchase online, for example. You first need a development environment for prototype development and experimental development. A microcontroller board is a board that includes the microcontroller, input/output devices, a power supply, and other essential components needed for the microcontroller to operate. These boards are often designed to connect to a personal computer, enabling software to be developed for the microcontroller. They are therefore ideal for prototype development and experimental development.


The difference between a microcontroller and IC

A microcontroller is a type of semiconductor product (IC), but it is one that can integrate a variety of components.

Examples of semiconductor product categories

Examples of semiconductor product categories
Figure 1. Examples of semiconductor product categories

The difference between a microcontroller and CPU

As mentioned, a microcontroller integrates various components on a single semiconductor chip. A CPU is one of the components integrated into a microcontroller—the most crucial component for the microcontroller’s operation. It can be thought of as the "brain" of the microcontroller. In a personal computer, the component that acts as the brain is the CPU, not the microcontroller.

Basic structure of a microcontroller
Figure 2. Basic structure of a microcontroller

In the early days of PCs and microcontrollers, there was not much difference in the performance of their CPUs. However, as the demand for ever-greater PC performance grew, the performance of their CPUs improved each year. On the other hand, the CPUs in microcontrollers have evolved based on the performance requirements of the products in which they are embedded. Functionally, it would be possible to equip all microcontrollers with higher-performance CPUs. However, higher performance usually means a higher price and higher power consumption. In some cases, they may not be suitable for embedding in certain products. For example, if a watch were equipped with a PC-grade CPU, its battery would quickly run out. This means that, regardless of era, there is a need and demand for microcontrollers that are optimized for the products in which they will be used.

Image illustrating the growth of PC and microcontroller CPU performance
Figure 3. Image illustrating the growth of PC and microcontroller CPU performance

What can a microcontroller do? Roles and functions

Microcontrollers are equipped with various functional circuits for input, arithmetic, memory, control, and output. Let's look at the roles and functions of each functional circuit.

  1. Input circuits
    Input circuits can input values based on the voltage level supplied to the input pins. For example, if 3.3 V is supplied to a pin of a microcontroller that operates at 3.3 V, an H level ("1") will be input. Conversely, if 0 V is supplied, an L level ("0") will be input.
  2. Arithmetic circuits
    Arithmetic circuits perform calculations using the input data and values stored in memory. The types of calculations they can handle vary by microcontroller, but even low-function microcontrollers can perform logical OR, logical AND, exclusive OR, addition (+), and subtraction (-). Higher-function microcontrollers can perform multiplication, division, multiply-accumulate operations *1, and floating-point operations*2.
  3. Memory circuits
    There are various types of memory circuits, such as read-only memory (ROM) and random-access memory (RAM), which can be read and written. Program code is written to ROM either during the microcontroller manufacturing process or when the product the microcontroller is embedded in is shipped. RAM can be freely read and written, but data in RAM is lost if the microcontroller loses power.
  4. Control (decision and branch) circuits
    These circuits make decisions and branch the program based on the results of calculations and the magnitude of values. The results of calculations are usually left in a flag within the CPU, and the program's branch destination changes based on this flag. Each decision is made through this branching of the program.
  5. Output circuits
    After the foregoing processing, output circuits output an H level ("1") or an L level ("0") to control external devices of the microcontroller.

The foregoing five operations are the most fundamental functions of a microcontroller, but microcontrollers are also equipped with various other peripheral circuits. The CPU can operate these to achieve various functions.

*1 Multiply-accumulate: An operation commonly used in digital signal processing, where the product of two numbers is calculated and added to an accumulator.

*2 Floating-point operations: One of the numerical computation methods used in computers. By expressing numbers in terms of a mantissa and an exponent, it allows for the approximation of extremely large or small values, thereby reducing data size.

Microcontroller operations and principles

Below is a block diagram of a typical microcontroller. While there are slight variations between different microcontrollers, the basic structure is generally as described below. We will use this block diagram to briefly explain the operating principles of a microcontroller.

Block diagram of a typical microcontroller
Figure4.Block diagram of a typical microcontroller

Note: The connections between each block are generally made using bus circuits*6, but for simplicity, we are using arrows to indicate the direction of data flow.

We will start by explain each block.

  1. Program counter
    The microcontroller operates in accordance with software (program code). Normally, program code is stored in memory, and there is a circuit that specifies the address in memory where the program code to be executed is stored.
  2. Memory (for code)
    This memory stores program code. Flash memory*3 is almost always used today. Flash memory is rewritable and the data it holds is not lost even when the power is turned off.
  3. Memory (for data)
    Memory used for temporarily storing data. Typically, static RAM*4 (SRAM) is used for this purpose. SRAM can be freely rewritten and operates on low power. However, SRAM loses all stored data when power is lost, so it is used only for temporarily storing data.
  4. CPU
    A circuit block that combines the arithmetic unit and the control unit. It retrieves the program code stored in memory and performs control operations or arithmetic logic operations.
  5. Peripheral circuits
    Different models of microcontroller have different circuits. Here, we show some common examples, including an oscillator circuit, timer, real-time clock, AD converter, and input/output circuits.

*3 Flash memory: A type of rewritable non-volatile memory. It cannot be rewritten without being erased first. Erasure is done in specific block units.

*4 SRAM: A type of rewritable volatile memory. It does not need refreshing.

*5 ALU: The arithmetic logic unit (ALU) is a circuit that performs arithmetic and logical operations.

*6 Bus circuit: A circuit that connects various circuit blocks with common signal lines and transfers data by segmenting the timing for each data transfer. This significantly reduces the number of lines required.


The operation flow of a microcontroller is as follows.

  1. Initialization
    Almost all microcontrollers have a reset pin. When this pin is set to either high (H) or low (L) level, the microcontroller system is initialized. In addition to the program counter and CPU, the peripheral circuits are initialized. Memory is not initialized except in very rare cases. The memory (for code) is pre-written with program code using a writing device.
  2. Program code output
    The program counter specifies the address of the memory (for code). In the initial state, the start address of the program is specified, and the memory (for code) outputs the first program code to be executed to the CPU.
  3. Interpretation and execution
    The CPU reads the first program code to be executed and interprets it. Based on the interpretation, it performs various controls. The program code controls can be roughly divided into the following three types:

    • Data transfer
      The CPU contains temporary storage areas called registers. The number and bit length of these registers vary depending on the CPU. Data is transferred between registers and memory, or between registers and peripheral circuits.
    • Arithmetic and logical operations
      Arithmetic operations are calculations such as addition, subtraction, multiplication, and division. Logical operations are operations such as logical OR, logical AND, and exclusive OR. The values stored in the registers are operated on, and the results are temporarily stored in the registers or memory (for data).
    • Decision (branching)
      Based on the results of arithmetic and logical operations or value comparisons, the address of the program counter to be read next is specified.
    Even when only data transfer or arithmetic and logical operations are executed, the value of the program counter always increases by one, pointing to the next address in the memory (for code).
  4. Peripheral circuit operation
    Operate in accordance with CPU instructions and control peripheral circuits. A variety of peripheral circuits are provided to realize a variety of functions.

Microcontroller applications Examples of how microcontrollers are used as electronic components and in products

Microcontrollers are used in a wide variety of devices. Below are some examples:

Product examples

Home appliances Air conditioners, rice cookers, washing machines, vacuum cleaners, air purifiers, microwave ovens, remote controllers
Residential equipment Door locks, water heaters, bathroom dryers, operation panels for air conditioners, electricity, etc.
Vehicles Automobiles, motorcycles, tractors
Industrial products Time switches, counters, timers, thermostats, temperature controllers, gas and water meters, multimeters
Portable devices Smartphones, watches
Medical & health devices Medical equipment, thermometers, blood pressure monitors, blood glucose monitors

The advantages of microcontroller use

Microcontrollers offer the following benefits:

  • Even complex processing can be controlled relatively easily.
  • A single microcontroller can be adapted to different embedded products simply by changing the software.
  • It offers a certain level of flexibility to accommodate sudden specification changes during product development.

Disadvantages:

  • Slower processing speed compared to dedicated ICs composed solely of hardware.
  • Higher unit cost compared to fully customized logic ICs.