Microprocessors and microcontrollers are the brains of digital electronic systems. A microprocessor is the brain of the computer and a microcontroller is the brain of embedded systems. The main difference between them is their architecture and area of applications, both are powerful processors of digital data and vital parts of modern electronic devices.
Before discussing the difference between the microcontroller and microprocessor, let us know about the components of a CPU and their application.
What is a CPU?
A Central Processing Unit (CPU) is an important part of a computer system that retrieves and executes instructions/commands and gives output as per the rules set by the computer programmer.
Central Processing Unit (CPU)
In general terms, a CPU is the brain of the computer system. It has the following components
- Control unit (CU) – Moves data around the system and issues signals to control hardware.
- Arithmetic logic unit (ALU) – Performs calculations .
- Registers – Memory required to store various kinds of data during calculations.
- Cache – A high-speed dedicated random access memory required for faster execution of instructions.
- Buses – Exchange of data between the processor and other components takes place through buses.
- Clock – It sends a signal to all components in order to keep them synchronized.
To execute any instruction CPU uses many interconnected components that include a processor, Arithmetic & Logic Unit (ALU), RAM, ROM, other memory-storage units, registers, cache, clock, and data bus, which have different roles. Defects or errors in any of these components will lead to the undesired output.
Factors Affecting CPU performance
- Clock speed
- Cache size
- Number of cores – A CPU’s processing unit is called a core
All CPUs have four main functions: Fetch, decode, execute, store the data.
Applications of CPU –
A CPU is found in every electronic device that receives input then processes them and then returns outputs for example personal computers, laptops, smart TV, smartphones, washing machine, tablets, printers, cameras, lifts, digital music players, drones, rockets, missiles, coffee vending machine, Mars Curiosity Rover, Tesla car, driverless train, autopilot mode of an airplane, etc.
Now let us pick any two devices from the example stated above say a printer and an aircraft.
Both these devices have the components of CPU to receive, process, and send output data, but their application is different.
A printer is programmed to print the data that is received, it may receive in any supported format but it will convert the data into a printable format supported by the printer. It will have thousands of lines of codes/instructions to perform the task. Thus this will not demand a high amount of RAM, ROM, cache, clock, registers, etc.
Now consider an aircraft, it is programmed to obey the real-time instructions that are sent by the pilot. If a pilot wants to turn left, then an aircraft should turn left instantly, and the same applies to any direction and on other tasks. A Boeing 787 aircraft has 6.5 million lines of code and demands a high amount of RAM, ROM, clock, register, cache, processor speed, etc. And the Boeing 787 aircraft needs regular up-gradation of its software. Obviously, the set of lines of codes will increase and it may demand more amount of RAM, ROM, clock, register, and cache. This means the CPU should be flexible for any alteration done to its connected system.
Aircraft
The concept of flexibility of components of CPU for a specific application creates a choice for microprocessors and microcontrollers.
A printer will have a single Integrated Chip in which all the components of CPU like RAM, ROM, registers, cache, clocks, analog to digital(A/C) converter, data bus, oscillator, input/output ports will be embedded in it but the capacity of those components will be limited(can be expanded in few advanced chips by connecting externally). This single IC in which all the components are embedded is called a microcontroller that is present in the printer. Expansion of the capacity of all the components cannot be done once fabricated.
Whereas in the aircraft the architecture is different, here only the processing unit(microprocessor) is in the single Integrated Chip whereas all the other components are located outside it because these components may be replaced in the future with higher capacities depending upon the application.
The CPU of an aircraft has to to multitasking like processing data from various parts of the planes but the printer has just to focus on a single task of printing.
In the same way devices like PC, laptop, Tesla car, Mars Curiosity Rover, etc carry out multitasking in real-time and demand flexibility in terms of storage, speed, etc microprocessors are integrated into them.
Since the devices which work on a microcontroller have to specific task rather than multitasking and every component is embedded within them, they are also referred to as an embedded system.
8 bit Microcontroller
The word micro is added along with the processor or controller due to its micro size.
Difference between Microprocessor and microcontroller
The differences we can frame depending on their fabrication/architecture are as follow:
A microprocessor chip has a controlling unit that performs Arithmetic Logical Unit (ALU) operations and communicates the same with the devices connected to it whereas a microcontroller is a single integrated chip that consists of ALU, RAM, ROM, Registers, Clocks, Cache, etc within that single chip.
A microcontroller is used for systems involving specific tasks whereas a microprocessor is used in systems involving multitasking.
The microcontroller uses an internal bus to communicate whereas the microprocessor uses an external bus to interface with RAM, ROM, Memory, and other peripherals.
Microcontrollers have on-chip flash memory to store and execute their program whereas programs are stored in an external disk in microprocessors.
Microprocessor and microcontroller definition:
A microprocessor, called a Central Processing Unit (CPU), executes computer programs by processing data. A microprocessor does not contain RAM, ROM, timers, etc within its chip.
A system designer tends to add RAM, ROM, timers, etc externally to make the system functional and the amount of RAM, ROM, and ports depends on the system application.
A microcontroller is a single chip with a CPU(a microprocessor) and a fixed amount of RAM, ROM, input/output ports, and timers on it.
A system designer cannot add external memory, ports, or timers to a microcontroller and hence they are ideal for a specific application where cost and space are primary factors in the system design.
Microprocessors are customizable and can be used in a variety of applications whereas microcontrollers are fixed and used for specific applications, this idea will help you choose between a microprocessor vs microcontroller for a system design or application.
Without microprocessors and microcontrollers, electronic devices are nothing. A personal computer(PC) has a microprocessor whereas embedded system devices like remotes, washing machines, air conditioners, lifts, etc have microprocessors.
Microprocessor Applications:
Microprocessors are manufactured for general-purpose systems that can handle multiple tasks at once. The systems that handle multiple tasks at once require a variable amount of memory and storage.
Examples include personal computers (PC), gaming devices, ATM machines, robots, defense systems, smartphones, servers, railways/airport traffic controller systems, etc.
The above systems handle multiple tasks simultaneously, so microprocessors are their right fit.
Microcontroller Applications:
Microcontrollers are specifically fabricated for embedded systems that require limited memory and storage to do specific tasks.
They are part of devices used in digital medical equipment, sensors, measuring devices, industrial devices, hi-tech systems, etc.
Examples are Electrocardiography(EGC) machines, remotes, digital cameras, washing machines, telephones, calculators, car systems, digital thermometers, etc.
The design engineers choose microcontrollers considering the size and cost of the device. External RAM, ROM, memory, timers, ports, etc make the system expensive, and complex, and more lines of code to perform the task.
Microcontrollers keep the system simple and light.
Important types of Microprocessors
- Complex Instruction Set Microprocessors
- The Application Specific Integrated Circuit
- Reduced Instruction Set Microprocessors
- Digital Signal Multiprocessors (DSPs)
Important types of Microcontrollers –
- 8-bit Microcontroller
- 16-bit Microcontroller
- 32-bit Microcontroller
- Embedded Microcontroller
- External memory Microcontroller
Useful Glossary –
- Computer system – A set of integrated devices takes, processes, stores and gives data
- Computer codes – A computer codes/program are a set of instructions that are executed by a computer
- Embedded system – A set of peripheral devices equipped with a microcontroller to perform a specific task
- Bit – A unit of measuring data in digital electronics