
What is a Microcontroller?
A microcontroller unit (MCU) is a compact integrated circuit designed to control a specific function in an embedded system. It consists of a small computer on a single chip that contains a processor (CPU), memory (RAM and ROM), and input/output peripherals. Microcontrollers are crucial in systems that require precise, low-power, and real-time control.
Microcontrollers are used in embedded systems ¨C specialized computing systems designed to perform dedicated tasks. These can be found in a wide range of applications, including:
- Automotives: MCUs are required for operations like engine control, power steering, airbag deployment, and infotainment systems).
- Factory Automation Systems: Microcontrollers serve as the brains of smart devices in manufacturing, being used to control machinery, manage assembly lines, and monitor environmental conditions.
- Robotics: MCUs collect, process, and communicate data with other devices or networks. They¡¯re used in industrial robotics to control the movement of motors or process sensor data and make decisions based on programmed algorithms.
- Medicine: Medical instruments, such as insulin pumps, heart rate monitors, and digital thermometers, also rely on microcontrollers to function.
- Energy Management: Microcontrollers are also widely used in the energy sector for devices like smart meters, photovoltaic solar inverters, and energy-efficient lighting systems to monitor and control energy consumption.
A microcontroller is a highly integrated semiconductor device that combines multiple components for different purposes. Each MCU is different, but all have the same core features:
- Central Processing Unit (CPU): The Central Processing Unit (CPU) is the brain of the microcontroller, responsible for executing instructions from the program stored in its memory. Single-core microcontrollers have one CPU, while multi-core microcontrollers have multiple CPUs.
- Memory (RAM and ROM): A microcontroller¡¯s memory is divided into different units for specific tasks. The RAM (Random Access Memory) is used for temporarily storing data, variables, and buffers that the CPU needs while performing tasks. The ROM (Read-Only Memory) or Flash Memory is used for storing the firmware or program code that the microcontroller executes. Flash memory is often used because it¡¯s non-volatile, meaning it retains the program even when power is lost.
- Input/Output Peripherals: The Input/Output (I/O) Peripherals include a variety of interfaces that allow the microcontroller to interact with the outside world. Common peripherals include digital I/O Pins, which are used to read or write binary signals (high/low) to and from external devices, such as sensors, LEDs, or buttons.
- Converters: Analog-to-Digital Converters (ADC) convert analog signals (e.g., from a temperature sensor) into digital values that the CPU can process. Conversely, Digital-to-Analog Converters (DAC) convert digital signals from the CPU into analog signals.
- Timers & Counters: Microcontrollers also use internal timers or counters for timing operations, generating precise delays, or counting external events.
- Communication Interfaces: Communication interfaces, such as UART, SPI, I2C, and USB, allow the microcontroller to communicate with other devices or chips.
- Clock Source: MCUs use a clock source (usually an internal or external oscillator) to generate the timing signals that synchronize the operation of the CPU and peripherals.
- Power Management: The central task of the power managementfeature is to reduce energy consumption, which is crucial in battery-powered applications. This mode can shut down portions of the chip when not in use or lower the clock speed to save power.
Microcontrollers run a sequence of instructions stored in their memory, continuously processing inputs, executing tasks, and controlling outputs. They do this with precise timing, low power consumption, and real-time responsiveness, making them ideal for controlling hardware in embedded systems.
1. The Microcontroller Powers Up & Reads Instructions
When a microcontroller is powered on, it fetches the first instruction from its memory (usually stored in the flash memory). This is the start of the program that it will execute.
The MCU¡¯s CPU then reads instructions from its program memory, one at a time. These instructions tell the CPU what operations to perform, like reading a sensor value or controlling an output device.
Once the instruction is fetched, the CPU decodes it to understand what action needs to be performed. This could involve arithmetic calculations, data transfer, or logical operations. The CPU executes the decoded instruction and stores the result in a register, sends it to a peripheral, or uses it to control other hardware.
2. The Microcontroller Uses Timers & Interrupts
Microcontrollers rely on timers for precise operations, such as generating delays, measuring time intervals, or producing PWM (Pulse Width Modulation) signals to control devices like motors or LEDs. After a microcontroller starts performing its instructions, it keeps an eye out for timer and interrupt inputs to carry out the required tasks.
Interrupts are signals that can temporarily pause the current task of the microcontroller to deal with urgent tasks. For example, if a button is pressed, an interrupt can cause the microcontroller to immediately respond to that event, regardless of what it was doing before.
3. The Microcontroller Continues its Loop
After handling any interrupts, the microcontroller resumes its previous task. MCUs typically run continuous loops, called "main loops", that repeatedly check inputs, update outputs, and perform necessary calculations. It continuously cycles through these operations as long as it is powered on.
4. The Microcontroller Enters Low-Power Mode (if Available)
Some microcontrollers, such as Infineon's AURIX TC3xx, include power-saving modes. This means when the microcontroller is not actively performing tasks, it can enter a low-power sleep mode to conserve energy, only waking up when there is an event, like a timer expiring or an input change, to resume normal operation.
If something goes wrong, or if the microcontroller receives a reset signal (like pressing a reset button), it will restart its operations by going back to the first instruction in the program and starting over.
There are several different types of microcontrollers to choose from. What is a PIC microcontroller, for example? Selecting the right MCU involves several important considerations and will depend on your specific requirements of and intended applications. To make an informed decision, consider the following:
- Project Requirements: What does your project need? Is it a sensor interface, a motor control system, or a complex IoT device? The complexity of the task will guide many of the decisions.
- Processing Power: For basic tasks, a microcontroller with an 8-bit or 16-bit CPU might suffice. For demanding applications like automotive engine control units (ECUs) and industrial automation systems, a 32-bit microcontroller with high clock speed might be the best choice.
- Input/Output Pins: You must also consider the number of input/output pins, GPIOs, analog inputs, PWM outputs, and communication interfaces (e.g., UART, SPI, I2C). Your chosen microcontroller must have enough pins to support all requested peripherals and sensors.
- Physical Size & MCU Housing: If the design has space constraints, a microcontroller in a smaller package (like LQFP or BGA) might be the best choice.
- Memory: You must estimate how much program memory is needed to store the firmware, including how much RAM is needed for variables, buffers, and stack usage during execution. Larger, more complex programs require more flash memory and RAM.
- Power Source: For battery-powered applications, low-power microcontrollers are essential. In this case an MCU with various power-saving modes (e.g., sleep and deep sleep) and low operating voltage would be ideal.
- Clock Speed: Higher clock speeds allow faster processing but also increase power consumption. This means you¡¯ll need a clock speed that balances performance and power usage for an application.
- Quantity Needed: You should always ensure the MCU is readily available in the needed quantities. Remember to determine the cost per unit and cross-reference this with your budget, especially if you require large quantities. Supply chain reliability is crucial, especially for long-term projects.
- Operating Temperature: Make sure your chosen microcontroller can operate within the temperature range required by your application, especially in industrial or automotive environments. If the MCU needs to comply with specific regulations (e.g., automotive or medical electronics), you need to guarantee that the microcontroller meets those standards.
- Additional Features: Depending on your requirements, you may need extra features. For example, if you¡¯re performing intensive mathematical calculations, additional features like hardware multiplication, floating-point units, or DSP capabilities are necessary.
You¡¯ll also need to consider whether you need a single or multi-core microcontroller. A single-core microcontroller has one central processing unit (CPU) that executes instructions sequentially. They¡¯re ideal for simple, low-power applications where cost and ease of development are priorities.
Meanwhile, multi-core microcontrollers offer superior performance and scalability for demanding tasks, making them suitable for more sophisticated applications. They feature more than one CPU core, allowing them to execute multiple threads or processes simultaneously. This architecture is more common in high-performance and complex embedded systems.
Microcontrollers support an Integrated Development Environment (IDE), libraries, and community support to significantly speed up development and troubleshooting. The AURIX MCU, for example, provides debugging tools like in-circuit emulators, JTAG/SWD debuggers, and other development aids which make life easier for developers.
Microprocessors (MPUs) and microcontrollers (MCUs) are both essential components in computing and embedded systems, but they serve different purposes and have distinct characteristics. MPUs are designed for general-purpose computing, while MCUs are built for dedicated control tasks in embedded systems, where low power, simplicity, and cost-effectiveness are key.
The table below shows the key differences of microprocessors and microcontrollers:
Microprocessors |
Microcontrollers |
¡¤ Excel in general-purpose computing. ¡¤ Used in computers for executing instructions and running multiple tasks under an operating system. ¡¤ Chip does not include built-in memory or I/O peripherals. ¡¤ Higher processing capabilities. ¡¤ Generally consume more power. ¡¤ Typically more complex and expensive. ¡¤ Require additional external components. |
¡¤ Designed for specific control tasks. ¡¤ Used to monitor external devices such as automotive systems and IoT devices. ¡¤ Built-in memory and peripherals. ¡¤ Examples include Infineon's AURIX, PSOC, and devices. ¡¤ Program and data memory are separate to allow simultaneous access to both. ¡¤ Designed for low power operation. ¡¤ Integrate all necessary components into a single chip. |
The Infineon microcontroller portfolio offers a comprehensive product range that includes state-of-the-art 32-bit microcontrollers that offer strong performance and future proven security solutions, along with traditional 8- and 16-bit microcontrollers. Our 32-bit MCU product portfolio includes:
- AURIX?: AURIX? microcontrollers are automotive qualified and designed to meet the needs of the most demanding embedded control systems applications where the competing issues of price/performance, real-time responsiveness, computational power, data bandwidth, and power consumption are key design elements.
- The Automotive PSoC?- Programmable System on Chip, integrate Infineon best-in-class capacitive sensing technology for demanding Human Machine Interface (HMI) applications in the automotive interior as well as exterior applications like Battery Management Systems (BMS) along with an ARM Cortex-M0/M0+ CPU, flash and memory.
- TRAVEO? T2G: Designed for transportation of the future, TRAVEO? T2G for automotive body electronics applications offers cutting-edge performance, safety, and security features.
- The 32-bit PSOC? 4 High Voltage family is designed for automotive functional safety, providing one-chip solutions for smart sensors that integrate analog front-end, MCU, and connectivity.
- The 32-bit PSOC? Automotive Multitouch controllers deliver high-performance capacitive touch solutions for automotive touchscreens, operating reliably in challenging environments.
- The 32-bit PSOC? Fingerprint microcontrollers, based on the ARM? Cortex?-M0+ processor, enhance and modernize the driver interface with programmable embedded System-on-Chip solutions
- PSOC?: PSOC? Microcontrollers are the world's only programmable embedded System-on-Chip solutions based on the ARM? Cortex?-M processor, high-performance programmable analog blocks, PLD-based programmable digital blocks, programmable interconnect and routing, and CapSense?.
- XMC?: The XMC? portfolio of MCUs is ideal for a broad range of industrial and consumer applications, offering optimal power, performance capabilities, and reduce costs all while providing greater design flexibility.
- MOTIX?: Our System-on-Chip (SoC) solutions enable PCB space saving, reduce cost through minimum number of external components, and enable multiple and flexible designs.