Microprocessor and MCU


We’ve been this far but we still don’t know how a robot makes decisions and processes data? Logic Gate ICs? But didn’t they make an ambiguous, huge, and complex circuit even just to do simple operations like additions? There are devices available that process data. Take your phone, for example, it can do a lot of operations rather than simple addition in such a small size. What gave this device such powerful abilities. They are *drumroll*




Microprocessors and Microcontrollers

Microprocessors and microcontrollers process information according to the instructions given with the input and generate an output.

This is how a microprocessor and a microcontroller look like:











Microprocessor

This is the genius saint sitting in your computer and mobiles. It is also considered as a computer brain, but also it is an incredible calculator! It can do all the arithmetic operations, handle all those big numbers, in fact, If you give this guy enough

information, it can do stuff like playing online games, or running microsoft windows! It is a controlling unit of a micro-computer. A single integrated circuit (IC) chip containing all functions of the CPU! It contains millions of components including transistors, resistors and diodes working together. How does it do all this stuff? Each microprocessor will have the following basic components:



So, you see above, the microprocessor takes input from input devices, is attached to the memory unit for storing data, and produces an output after processing according to the set of instructions given.

By input, we mean normal input which you give through keyboard and other input devices and output means the output we see on our screens.

We will focus on what are the components that make up a microprocessor. They are units that control what to do, how to do it, and where to store.

The microprocessor has a:

  1. ALU
  2. Control Unit
  3. Register array


Arithmetic-Logic Unit

It is the part of a microprocessor that carries out the arithmetic and logical operations inside a microprocessor. The inputs to an ALU are

  1. data to be operated on, called operands, and
  2. a code indicating the operation to be performed;


The output of the ALU is the result of the performed operation. For example, you gave your microprocessor a task to calculate 1+2, then 1 and 2 are the operands, and the ‘+’ is the instruction that tells what to do with the operands, this was an example of arithmetic operation. What are logical operations then? AND, OR, and NOT are all logical operations. Were you able to guess them?

Control Unit

Now that our ALU has given a task to calculate 1+2, ALU deduces that we have to add 1 and 2 but control is needed for the instruction so provided to add numbers to ALU. Hence, the control unit came into the picture. The control unit directs the operation of the microprocessor, it tells the memory, ALU, input, and output devices about how to respond to the instructions given to them.



Register array

Our processor now knows what to do and how to do it, but we need to have some space to store that data. So, microprocessors have register arrays for that purpose.

But what is a register?

A register is a storage element, quickly accessible location available to microprocessors.

Arrange multiple registers to get an array of registers to store more data.

Many of you must have heard ram as memory used for fast operations with the microprocessor. If so then why do we need registers for our microprocessor, can't it just store data and coordinate with RAM? Try to figure out why? If you need any help, feel free to ask us.

How does a microprocessor work?

The microprocessor follows a sequence: Fetch, Decode, Read address from the memory(if needed), and then Execute.

Initially, instructions are stored in the memory in sequential order. The microprocessor fetches those instructions from the memory, then decodes it, and then if some data from another memory address is needed then it reads that data and then executes those instructions and the cycle repeats until STOP instruction is reached. Between these processes, the register stores the temporary data, and ALU performs the computations.

Here’s a glossary of some of the frequently used terms in a microprocessor:

Instruction Set: It is the set of instructions that the microprocessor can understand.

Clock Speed: It determines the number of operations the processor can perform per second. It is expressed in megahertz (MHz) or gigahertz (GHz). It is also known as Clock Rate.

Data Types: The microprocessor has multiple data type formats like binary, BCD, Hexadecimal.

Applications of Microprocessor

  1. Microprocessors are used in computers and laptops where heavy processing is required.
  2. Many medical devices, like an insulin pump, are typically controlled by a microprocessor. The microprocessors perform various functions, such as processing data from bio-sensors, storing measurements, and analyzing results.

Examples of Microprocessors

Here are some microprocessors with links attached to them for more info.


Intel 4004, the first-ever microprocessor created


Intel 8085, a microprocessor that can perform basic arithmetic and other logical operations


AMD Ryzen 9 5950X, a microprocessor by AMD
Intel Core i9-10900K, a microprocessor by Intel

Now, you know about genius saints sitting at the core of your devices.

Assuming you have a good impression of what microprocessors are. It’s time to talk about MCU (dun dun dun)…


Nope, not that MCU.

So by MCU, I mean(uh..uh?) The microcontroller unit.

A microcontroller is a small and low-cost microcomputer, which is designed to perform the specific tasks of embedded systems like displaying microwave information, receiving remote signals, etc.

The general microcontroller consists of the processor, the memory (RAM,ROM, EPROM), Serial ports, peripherals (timers, counters), etc.

Where can you find them?

They are almost everywhere, from simple devices like washing machines, traffic lights, microwave ovens to highly sophisticated satellite systems. A 1999 BMW 7-series has 65 microcontrollers. Although the microcontrollers in PCs are the most visible, they account for just 6% of the microcontroller market. Microcontrollers are used in applications requiring repetitive operations such as running the traffic light at an intersection. In traffic lights, the microcontroller's sole function is to turn lights on and off at predetermined times.

Another example is a microwave oven. Let's examine how a microcontroller functions while cooking a bag of popcorn in a microwave oven.

You open the door and put the bag of popcorn inside. You close the door and push the button labeled "Popcorn." A few minutes later, a tone announces the popcorn is done. What happened behind the scenes?

When you opened the door, the microcontroller sensed the door switch, turned on the light, and disabled the magnetron. The microcontroller continually scans the keyboard. When you pushed the "Popcorn" button, the microcontroller confirmed that the door was closed and began to count timing pulses, started the motor for the turntable, set the power level of the magnetron, and controlled the display. When the timer reaches zero, the microcontroller shuts down the magnetron, stops the turntable, and signals you.


Controller board of a washing machine which controls the time of motor rotation, speed, buzzer control, 8-segment display control, etc. The board has a microcontroller ST7LITE49M.

Components of a microcontroller




CPU: It is the processing unit of any computer. It is the “brains” of the microcontroller. It is what fetches the instructions from the code memory and executes the instructions that it fetches.
RAM: The data RAM (Random Access Memory) is the data space that is used for temporarily storing constant and variable values that are used by the microcontroller during normal program execution.
EEPROM: The on-chip EEPROM memory (Electrically Erasable Programmable Read-Only Memory) on a microcontroller is like a microcontroller’s hard drive. It has two partitions. One partition is reserved for the storage of the program code i.e program memory while the other partition is reserved for permanent storage of data i.e data memory, used by the chip during normal program execution.
I/O ports:These are the ports that are used to provide binary data to the microcontroller and to fetch processed binary data from the microcontroller. They provide a channel to communicate with the microcontroller.
Timers and counters: Counters are simply used to generate a count in electronics such as 1,2,3,4. You also must know timers from the description where the 555 timer IC is described. In similar ways, microcontrollers are embedded with such components that act as timers and counters inside the microcontroller to perform time and count related tasks.
Oscillators: An oscillator embed in a microcontroller is used to provide a clock to the microprocessor of a microcontroller. In a microprocessor, every instruction is executed in synchronization with the clock. To achieve high clock speeds, an external oscillator can be used with a microcontroller.
A/D Converters(Analog to Digital Converters and Digital to Analog Convertors) Any microprocessor needs data to be in digital form i.e data has to be in a binary state to be processed. In microcontrollers, the CPU too requires digital data to work on but the input provided by devices is analog signals of voltage. So data needs to be converted into digital signals so analog to digital converters is present in a microcontroller to aid the processing.

After data gets processed according to the instructions, the processed data in digital form is again needed to be converted into analog signals as most of the output devices need analog signals to show output. So, a digital to analog converter is also embedded inside a microcontroller for this purpose. Remember, there are external converters also available.

Classification of MCUs

Microcontrollers are classified into various categories based on memory, architecture, bits, and instruction sets. Following is the list of their types −

1. On the basis of the number of bits

Based on the number of bits microcontroller can process in one clock cycle, the microcontroller is further classified into three categories:
a. 8-bit microcontroller: Microcontrollers that process 8-bit of information in one clock cycle. This type of microcontroller is used to execute arithmetic and logical operations like addition, subtraction, multiplication division, etc. For example, Intel 8031 and 8051 are 8 bits microcontrollers.
b. 16-bit microcontroller: Microcontrollers that process 16-bit of information in one clock cycle. This type of microcontroller is used to perform arithmetic and logical operations where higher accuracy and performance are required. For example, Intel 8096 is a 16-bit microcontroller.
c. 32-bit microcontroller: Microcontrollers that process 32-bit of information in one clock cycle. This type of microcontroller is generally used in automatically controlled appliances like automatic operational machines, medical appliances, etc.

2. On the basis of memory

Based on the memory configuration, the microcontroller is further divided into two categories:

a. External memory microcontroller: This type of microcontroller is designed in such a way that it does not have a program memory on the chip. Hence, it is named an external memory microcontroller. For example, Intel 8031 microcontroller.
b. Embedded memory microcontroller: This type of microcontroller is designed in such a way that the microcontroller has all programs and data memory, counters, and timers interrupt, I/O ports are embedded on the chip. For example, Intel 8051 microcontroller.
3. On the basis of Memory Architecture

Based on the memory architecture on which microcontroller is created, they can be classified into two categories:
a. Based on Von Neumann Memory Architecture: These Microcontrollers have common memory for storage of data as well as programs.
b. Based on Harvard Memory Architecture:These Microcontrollers have separate memory units (and separate buses) for storage of data as well as programs.


Some of the examples of microcontrollers are ATmega328, ATtiny85, ESP8266, etc.
You’ll see the use of some of the microcontrollers mentioned above in the blog of Development boards.


Applications of Microcontrollers


Microcontrollers are used for specified tasks where the tasks are predefined. They are used in different devices such as −

- Light sensing and controlling devices like LED.
- Temperature sensing and controlling devices like microwave oven, chimneys.
- Fire detection and safety devices like a Fire alarm.
- Measuring devices like multimeters.

Difference between Microprocessors and Microcontrollers


What is the need for Microcontrollers if we already had Microprocessors or vice versa A simple difference chart will surely clarify all such doubts.