What is a Microcontroller and How Does it Work?
What is a Microcontroller?
A microcontroller is a compact integrated circuit designed to control a specific operation in an embedded system. A typical microcontroller includes a processor, memory, and input/output (I/O) peripherals on a chip.
Sometimes referred to as an embedded controller or microcontroller unit (MCU), microcontrollers are found in vehicles, medical devices, office machines, robots, mobile radio transceivers, vending machines, and home appliances, among other devices. These are basically simple small personal computers (PCs) designed to control small features of a larger component, without a complex front-end operating system (OS).
How does a microcontroller work?
A microcontroller is embedded within a system to control a single function in a device. It does this by using its main processor to interpret data received from its I/O peripherals. Temporary information received by the microcontroller is stored in its data memory, where the processor accesses it and uses instructions stored in its program memory to interpret and apply incoming data. It then uses its I/O peripherals to communicate and implement the appropriate action.
Microcontrollers are used in a wide array of systems and devices. Devices often use multiple microcontrollers that work together within the device to handle their respective functions.
For example, a car may have many microcontrollers that control various individual systems inside, such as an anti-lock braking system, traction control, fuel injection, or suspension control. All the microcontrollers communicate with each other to inform the correct operations. Some can communicate with the more complex central computer inside the car, and others can only communicate with other microcontrollers. They send and receive data using their I/O peripherals and process that data to perform their assigned tasks.
What are the elements of a microcontroller?
The basic elements of a microcontroller are:
- There are two main types of memory in a microcontroller:
- Program Memory: which stores long-term information about the instructions that are executed by the CPU. Program memory is non-volatile memory, meaning it holds information over time without requiring a power source.
- Data Memory: which is required for temporary data storage while instructions are being executed. Data memory is non-volatile, meaning the data it holds is temporary and is only retained when the device is connected to a power source.
While the processor, memory, and I/O peripherals are the defining elements of a microprocessor, there are other elements that are often included. The term I/O peripherals itself refers only to auxiliary components that interface with memory and the processor. There are many supporting components that can be classified as peripherals. Some form of I/O peripheral is fundamental to a microprocessor, as it is the mechanism by which the processor is implemented.
Other supporting elements of a microcontroller include:
Features of microcontroller:
The processor of the microcontroller will vary depending on the application. Options range from simple 4-bit, 8-bit or 16-bit processors to more complex 32-bit or 64-bit processors. Microcontrollers can use non-volatile memory types such as random access memory (RAM) and non-volatile memory types -- including flash memory, erasable programmable read-only memory (EPROM), and electrically erasable Includes Programmable Read Only Memory (EEPROM).
In general, microcontrollers are designed to be easily used without additional computing components because they are designed with ample onboard memory as well as pin offerings for general I/O operations. , so that they can interface directly with sensors and other components.
A microcontroller architecture can be based on the Harvard architecture or the von Neumann architecture, both offering different ways of exchanging data between the processor and memory. With the Harvard architecture, the data bus and instructions are separate, allowing simultaneous transfers. With the 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 typically has around 80 instructions while RISC has around 30, plus more addressing modes, 12-24 compared to RISC's 3-5. Although CISC may be easier to implement and may have more efficient use of memory, it may suffer from performance degradation due to the high number of clocks required to execute instructions. RISC, which emphasizes software, often provides better performance than CISC processors, which emphasize hardware, because of its simplified instruction set and, therefore, simplicity of design. Increases, but because of the emphasis it places on software, the software can be more complicated. Which ISC is used varies by application.
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), universal synchronous/asynchronous receiver-transmitter (USART), timers, universal asynchronous receiver-transmitter (UART), and universal serial bus (UART). ) Included. USB) connectivity. Sensors that collect data on humidity and temperature, among others, are often also connected to microcontrollers.
Types of microcontroller:
Common MCUs include the Intel MCS-51, often referred to as the 8051 microcontroller, which was first developed in 1985. AVR microcontroller developed by Atmel in 1996; Programmable Interface Controller (PIC) from microchip technology; and various licensed Advanced RISC Machine (ARM) microcontrollers.
A number of companies manufacture and sell microcontrollers, including NXP Semiconductors, Renesas Electronics, Silicon Labs and Texas Instruments.
Microcontrollers are used in a variety of industries and applications, including home and enterprise, building automation, manufacturing, robotics, automotive, lighting, smart energy, industrial automation, communications and Internet of Things (IoT) deployments.
A very specific application of a microcontroller is its use as a digital signal processor. Often, incoming analog signals come with a certain level of noise. Noise in this context means ambiguous values that cannot be easily translated into standard digital values. A microcontroller can convert a noisy incoming analog signal into a single outgoing digital signal using its ADC and DAC.
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. . They are common in office machines such as photocopiers, scanners, fax machines and printers, as well as in smart meters, ATMs and security systems.
More sophisticated microcontrollers perform important functions in aircraft, spacecraft, submarines, vehicles, medical and life support systems, as well as robots. In medical scenarios, microcontrollers can regulate the operation of artificial hearts, kidneys or other organs. They can also play an important role in the functioning of prosthetic devices.
Microcontroller vs Microprocessor:
Microprocessor vs Microcontroller - 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 a direct connection to sensors and actuators, whereas 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 consume less power than microprocessors. Microprocessors do not have built-in RAM, read-only memory (ROM) or other peripherals on the chip, but connect them to their own pins. A microprocessor can be considered the heart of a computer system, while a microcontroller can be considered the heart of an embedded system.
|General computing (i.e. Laptops, tablets)
|Appliances, specialized devices
|Medium to high
|Very low to low
|Intel, AMD, ARM
|Atmel, Microchip, ST, Texas Instruments
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, consideration must be given to optimal speed, amount of RAM or ROM, number or types of I/O pins on the MCU, as well as power consumption and constraints and development support. Be sure to ask questions such as:
How does the microcontroller communicate with the external peripherals memory?
Microcontroller communicate with the external peripherals memory via I/O ports. External peripherals usually communicate to each other using communication protocols, like SPI or I2C. I2C protocol analyzer looks at the traffic between an external serial EEPROM and a PIC microcontroller.