From the early days of computation, microprocessor designs have come a long way in making the chips more capable and faster, while at the same time reducing their overall power consumption for cool and quiet, yet powerful operation. However, during the mid-1970s, the Texas Instruments TMS 1000 was invented which packaged system memory along with the processor. Such chips came to be known as Microcontrollers. Thus, the short answer to “Microprocessor vs Microcontroller” is that unlike microprocessors which need separate memory (RAM, ROM, etc.) to function, a microcontroller integrates said memory onto the same chip. However, if you care about a more detailed explanation, please feel free to read on.
So before we jump straight into microcontroller vs microprocessor, let us briefly understand how useful computation is actually performed at the core of such chips.
A microprocessor or a microcontroller is an especially fabricated piece of silicon that acts as the controller in a micro-computer. It is responsible for various functions such as making logical decisions (X > Y?, etc.) and computations (function of the Arithmetic Logical Unit, or ALU), along with communication between various devices such as I/O devices, storage devices, etc.
History of Microprocessor vs Microcontroller
The development of the MOSFET, and its many benefits such as increased transistor density, lower power consumption, etc. was a critical contributor to the feasibility of the modern microprocessor. With the launch of the Intel 4004 as the first commercially available microprocessor, the power to perform thousands of calculations electronically was brought into the mainstream market and the development of the microprocessor technology was off to the races.
It was soon followed by other extremely popular microprocessors such as the 8008 and the 8085 and microcontrollers such as the 8051. Around the same period, the x86 instruction set was developed, which has been further extended and refined over the years, serving as the instruction set most computers today are based on. Meanwhile, shrinking of the manufacturing process and including technologies such as pipelining, multi-core design, multi-threading, etc. has helped propel the microprocessor technology to the performance figures, robustness and maturity we are used to in the modern day.
A Microprocessor is a clock-driven machine, i.e. an oscillator produces pulses of fixed time intervals which coordinates and synchronizes the various functions of the microprocessor or microcontroller. Consequently, the higher the clock speed (number of clock cycles per second, measured in MHz or GHz), the smaller the time taken by each pulse or clock cycle.
A microprocessor or microcontroller works by reading a binary input from the memory, fetching the corresponding instruction followed by decoding and executing said instruction. It can be summarized as a 3-step process- Fetch-Decode-Execute. Depending on the instruction, execution might take a single clock cycle, multiple instructions might be executed during the same clock cycle, or a singular instruction might even require multiple clock cycles. The number of clock cycles a microprocessor or microcontroller performs per second is it’s clock rate, or clock speed. The total number of instructions a microprocessor is capable of executing in a second is thus often used as an approximation to gauge the overall performance of the chip.
It is thus generally pointless to compare various processor’s clock speeds to rank them according to performance. Depending on the architecture, a processor might be capable of handling more instructions per clock but have a lower clock speed and perform similarly to a processor which can execute relatively lesser instructions per clock but has a higher clock speed.
It is thus evident that a critical ingredient for the working of a microprocessor or microcontroller is its instruction set. There are two main types of Computer Organization- CISC and RISC.
CISC (Complex Instruction Set Computer) is a type of Computer Organization that prioritizes more jobs performed per instruction at the cost of such complex instructions requiring more cycles to execute. This is done mainly to reduce the number of lines of assembly code that needs to be written as it is difficult, error prone and tedious.
For example, the ‘MUL’ instruction in the x86 instruction set accepts the source register or memory address as input, multiples the value at source with the value present in the ax register and stores the output back into the ax register (dx:ax register pair to be exact). This is equivalent to the C++ code- “a = a * b;”. Here reading value, performing the multiplication operation and storing the output is performed in a single instruction.
RISC (Reduced Instruction Set Computer) on the other hand prioritizes reducing cycles per instructions at the cost of increased number of instructions per program. Considering the previous example, the same operation can be divided into three separate instructions- loading value into the memory or registers, multiplying the loaded values and storing the resultant in a memory location or register/register pair. Such an approach allows each instruction to be completed within a single clock cycle thus allowing for more efficient pipelining, giving greater control over the data stored in registers, freeing up more physical space on the chip to include more registers and reduces the need to reload the same data (if needed) into the same register at the end of each such instructions.
Key differences: Microcontroller vs Microprocessor
A Microcontroller generally has an inbuilt flash memory using which programs are stored and executed, along with necessary I/O components. Storing programs in such a fashion translates to quicker startup time and faster program execution but at the cost of limited storage space. Depending on the complexity of the application, a Microcontroller might need to be custom designed in order to suit the same since most Microcontrollers in the market are limited to 2 Megabytes of Program Memory.
What does Program Memory mean? Microcontrollers are based on the Harvard Architecture where Program Memory and Data Memory are separate, i.e. variables or other data are stored in the data memory while the Program memory only houses the program the microcontroller is supposed to execute and its constants (if required).
Unlike a Microcontroller, however, a Microprocessor does not come with an inbuilt memory, I/O components, or clear divisions between Program and Data Memory, as it is based on the von Neumann architecture. A Microprocessor is made to be dynamic in terms of the programs that it can handle, i.e. it is purpose built to be able to handle programs that a user might require instead of being purpose built to cater to only one type of job specifically. Since a Microprocessor depends on an external memory to function, a user is free to choose the memory capacity that they might require for their use case and install it into the system accordingly.
A Microprocessor is generally relatively better suited for more number-crunching applications as compared to a Microcontroller. It is because a Microprocessor is more flexible and can thus be tailored to fit the processing overhead required along with generally coming equipped with a TFT LCD controller.
Even though modern Microprocessor and Microcontroller alike include a variety of communication channels, higher speed communication technologies such as gigabit ethernet, USB 3.1, etc. are generally more common in Microprocessors. They are thus more capable of handling and processing large amounts of data. However, for more deterministic or time-critical applications, a microcontroller might be more suitable.
Microcontrollers are generally known to be more conservative at sipping power. This is due to the fact that Microcontrollers are built with tight power budgets in mind as they are generally used in industrial or business applications where cost of ownership is one of the biggest factors in choosing a certain product over another. They also find widespread utility in low-power electronics which tend to require little to no User Interface but come with a very stringent power budget, such as remote controls, microwave oven control, etc.
Summary – Microprocessor vs Microcontroller
Microcontrollers are thus the foundation of Embedded Systems. An Embedded System is a computation-based system that integrates all the hardware components into a single chip and is generally purpose built for specific applications or to perform a dedicated function, either as a dedicated system or as a part of a larger system. Microprocessors on the other hand, form the heart of a more traditional computer system.
Generally, a Microprocessor is more flexible and better at handling large amounts of data or raw processing power while Microcontrollers are generally not built to excel at benchmarks. They are purpose-built machines which cater to very specific requirements while being cost effective, scalable and power-efficient.