Beginners tend to get confused by the terms microcontroller and microprocessor. In many places they are used interchangeably and the task accomplished by both are the same. So why are two different names used for the same product?
There is some difference between the two.
A microprocessor simply consists of the processor, the ALU (Arithmetic Logic Unit), the Instruction Decoder and a few registers which are used to store data for mathematical and logical operations. The ROM/RAM in which the program is to be stored, the I/O pins, timers etc all have to be added to the microprocessor separately using discrete devices.
E.g – 8085, 8086
On the other hand, a microcontroller includes a processor, the ALU, Instruction Decoder, registers, code storage space(flash memory/ROM), RAM, general purpose I/O pins, timers, interrupt controller, serial communication module etc. That is, the microcontroller is a microprocessor with some basic modules.
E.g – 8051, Atmega8, PIC 18F4550
Advantage of Microprocessors:
We can use the same microprocessor everywhere and add the peripherals according to the requirement of the project. The basic code remains the same, only the code for interfacing the peripherals changes. For large projects, this leads to smaller turnaround time and lower cost.
Disadvantage of Microprocessors:
Board size is larger than a microcontroller based project since there are a large number of discrete components.
Different peripherals are used in different projects. The datasheet of each new component has to be studied and each component separately interfaced with the processor.
The quirks of each component have to be noted and kept in mind.
Advantage & Disadvantage of Microcontrollers:
Everything is included in a small IC. Almost all the peripherals are on board. The disadvantage is that the designer has to be content with the performance of the onboard peripheral. Usually specific peripherals are the specialty of specific companies. One may be a market leader in microcontrollers but Analog to Digital converters may be the specialty of some other company. But if the performance of the onboard component is good enough for the project, the onboard peripheral is used. And if later it is found that even higher performance is required, then there is no other option than using a discrete component.
But usually, the performance of basic peripherals like timers, serial communication, interrupt controllers of most microcontrollers is good enough not to warrant the use of separate devices. And in general, the performance of peripherals is getting better day by day. One day it may so become that no external peripheral is required even for high performance products.
If the designer is using controllers from the same manufacturer, usually the registers required for initialization and configuration options of the peripheral is the same. So the same code can be used over and over again. But in some cases, especially if a controller from some other manufacturer is used, the peripheral registers and configuration bits may change. In that case, the advantage is negated and the peripherals have to be configured from scratch.
In the present day, there are so many microcontrollers with assorted types of peripherals onboard that the board designer is spoilt for choice. So he/she chooses the controller after making a comparative study of the essential peripheral requirements of the project, cost of the chip and how familiar the designers are with the company/IC in question. In general, more exotic the peripheral, more the price of the controller. In some cases, it may make better economic sense to use an external peripheral with a low cost controller rather than go for a much higher priced controller with the peripheral onboard.