Basic microcontroller configuration
The name "MCU" was originally derived from the abbreviation for "microcomputer," which was used to refer to large computers such as supercomputers in an era when PCs were not as widespread as they are today. In contrast, what is now called a MCU is a single-chip IC specialized for controlling electrical devices and is appropriately called a "microcontroller".
An all-in-one IC has a CPU that executes calculations, ROM memory that stores programs, RAM memory that temporarily stores calculation data, a timer function that counts externally given pulse signals and measures time, an AD converter that takes analog signals from sensors and processes them, a DA converter that converts calculated data into analog signals, and peripheral functions such as communications with external devices. I explain the details in next section "Basic knowledge around Microcontroller for Embedded engineers"
All of these functions are built into MCU in a single package, and all of the arithmetic processing is much faster and more powerful than at the time.
If you know the basics of MCUs, you can build a small system as soon as you think of it, in a short time and at a low cost.
When there is a change in function specifications, all hardware components such as electric circuits need to be rebuilt, but software components only need to be reprogrammed.
In other words, the larger the percentage of software in a product, the more flexible it is to respond to changes in specifications. This tendency is strongly manifested in recent smartphones.
Cell phones of long ago are also a type of embedded device, but they are operated by hardware button switches. Even minor changes in design and other specifications require a complete rebuild.
In contrast, smartphones are operated by touch panels, so there is no need for hardware such as button switches.
Where are MCUs used in our daily lives? MCUs are used in almost all household appliances, such as rice cookers, air conditioners, televisions, smartphones, and ceiling lights.
Rice cooker with MCU:
Let's look at the relationship between rice cookers and MCUs.
A rice cooker cooks rice by adjusting the amount of water in the rice cooker and the amount of heat to cook the rice properly.
- Rinse the rice and set the kettle for the proper amount of water.
- Start cooking rice over medium heat.
- Bring to a boil and turn off heat when appropriate.
- Steam for a certain period of time
When rice is cooked by hand, the key to delicious rice is to adjust the heat and time properly. Electric rice cookers consist of a timer, a sensor such as a bimetal that detects temperature, and a heater that heats the rice.
Electric rice cookers without MCUs can now cook rice fully automatically using a timer, which is very convenient compared to cooking rice by hand, but the simple functionality does not allow the cooker to cook rice to the desired degree.
In contrast, a MCU-equipped rice cooker has a MCU between the temperature-sensing sensor and the heater for heating. The amount of heat to the heater is controlled by switching elements such as relays and SSRs operated by the MCU output.
As a system, the input information obtained from the temperature sensor is programmed in the MCU (software) to adjust the output to the heater to achieve the optimum heat level.
The actual system configuration of a rice cooker using a MCU includes a temperature sensor and start switch for input, a heater for output, and a monitor that displays the operation status of the rice cooker.
The program (software) by the MCU diversifies the functions and allows the cooker to cook various types of rice to the desired degree.
MCU-based switch function:
Next, let's take a look at the MCU-mounted example with the operation of the switch.
Switches in electrical products mechanically connect and disconnect contacts to directly conduct or isolate the current in a circuit, switching the product function on and off.
In the case of an electrical product with a MCU, if a mechanical switch is connected to the MCU input and output functions as a switch, it can be programmed not only to turn on or off, but also to perform various functions, such as a long press, by combining it with time.
In this way, the switch looks like a conventional mechanical single-function switch, but it is transformed into a switch with multifunctional characteristics.
For example, let's look at a circuit in which an LED is turned on by a switch.
In the case of an analog LED circuit, it is a simple circuit (Figure 1) that emits light when the switch is turned on and turns off when the switch is turned off. A similar circuit can be realized with MCU as shown in Figure 2.
The switch shown in right side is a so-called digital signal that provides an ON state (1) and an OFF state (0) as inputs to MCU. By checking this input status with MCU and processing it in some way, we can make any output, i.e., any LED light, turn on at will.