Microcontrollers play an important role in the world of Embedded Systems. Any technological device around us is built with a Microcontroller. This post will discuss about what is Microcontroller, how it works, its various classifications, architectures, applications, advantages and disadvantages.
What is Microcontroller
Microcontroller is a device that captures the input, processes it and generates output based on the information captured. It is also called MC or MCU (Microcontroller Unit) which is a compact digital processor on Metal-Oxide-Semiconductor Chip. Microcontrollers are also called as “special purpose computers”. They are dedicated to execute specific task that is programmed and stored in ROM.
Fig. 1 – Introduction to Microcontroller
They are available with on board Memory and I/O Ports which eliminates building a circuit that has separate external RAM, ROM and Peripheral chips. MC’s operate at lower speeds, capable of retaining functionality and consume less power. These features of Microcontrollers make it an ideal choice for embedded applications.
Fig.2 below shows Single-Board MC also called Development Board Microcontroller built onto a single Printed Circuit Board (PCB). It provides necessary circuitry including Processor, Memory, Clock, I/O circuits etc. They are popularly used for educational purposes to gain experience as they are available at low cost.
Fig. 2 – 8051 Microcontroller Development Board
Classification of Microcontroller
Microcontrollers are broadly classified into various categories based on:
- Bit Configuration
- Instruction set
Microcontroller Classification on the basis of Memory
MC is further divided into two categories based on their Memory configuration. They are:
- External Memory Microcontroller
- Embedded Memory Microcontroller
External Memory Microcontroller
This type of MC do not have a program memory on the chip. Example – Intel 8031 MC.
Embedded Memory Microcontroller
This type of MC has all programs and Data Memory, Counters and Timers, Interrupts, I/O Ports embedded on the chip. Example – Intel 8051 MC.
Fig. 3 – Classification of Microcontroller
Microcontroller Classification on the basis of Architecture
There are two types of MC Architecture:
- Von Neumann Architecture
- Harvard Architecture
Von Neumann Architecture
This type of architecture has common Memory for storage of data and programs.
This architecture has separate Memory units for Program and Data Storage and separate Busses for transfer of data and instructions.
Microcontroller Classification on the basis of Bit Configuration
There are three types of Microcontroller based on Bit configuration. They are:
- 8-bit MC
- 16-bit MC
- 32-bit MC
8-bit Microcontroller is basically used to execute arithmetic and logical operations like addition, subtraction, multiplication division. It processes 8-bits of data at a time. E.g. Intel 8031 and 8051 Microcontroller.
This type of MC is used in the applications where higher accuracy and performance is required. It is also used to perform arithmetic and logical operations E.g. Intel 8096.
This type of MC offers superior processing speed and can handle multiple peripherals and generally used in automatically controlled appliances like medical appliances, computer applications etc.
Microcontroller Classification on the basis of Instruction Set
MC is classified into two types based on the Instruction Set configuration. They are:
CISC is an acronym for Complex Instruction Set Computer. CISC allows the user to insert a single instruction as an alternative to many simple instructions.
RISC is an acronym for Reduced Instruction Set Computers. RISC helps in reducing the operational time by shortening the clock cycle per instruction.
The most popular 8051 Microcontroller is designed using Harvard Architecture and hence this type of Architecture has been considered here to explain its components. The various components/modules of Microcontroller are:
- Processor Core
- Interrupt Controller
- Digital I/O
- Analog I/O
- Watchdog Timer
Fig. 4 – 8051 Microcontroller Architecture
It is the Central Processing Unit of the Microcontroller and consists of Arithmetic Logic Unit (ALU). This unit is responsible for the execution of arithmetical and logic operations.
It controls the operation of MC and is represented by STATUS Register. It helps in transfer of data to other registers.
There are two types of data memories in a MC. They are:
- Static RAM (SRAM)
Static RAM (SRAM)
SRAM consists of Special Function Registers (SFR) and General Purpose Registers (GPR). SRAM are 8 bit memory cells that provide link between the Microcontroller hardware and software.
The Write cycle (Program/Erase) of this memory is unlimited but the data stored in SRAM is lost if the power to the controller is lost. Hence EEPROM is also used for Data storage.
Special Function Registers (SFR) controls the functional blocks whereas the General Purpose Registers (GPR) stores the values of variables and constants.
It is a type of non-volatile electronic memory, which is used for storage of data. EEPROM memory is comparatively slow and has limited number of write cycles and hence used to store the data that needs to be saved when power supply of MC is switched off.
This module has Timer/Counter which measures the time and calculate the events. Usually a MC contains 2-3 Timer/Counters and it operates in Timer or Counter mode and calculates the number of received pulses. Timer also generates PWM Signal which is converted to DC voltage using Low Pass Filters.
This module consists of Digital I/O. It helps the Microcontroller to detect and output the logic states (High or Low).
This module consists of Analog I/O. It helps in converting voltage level to digital value. Most MC’s have integrated Analog-Digital converters. To generate Analog output RC Low Pass Filters are used to convert PWM outputs to DC voltage.
Serial Interface Module
They are designed to receive or send the digital signals to other devices. Most controllers are provided with SPI, SCI, Ethernet, USB interfaces.
As the name indicates, it observes the execution of the MC program. It generates ‘RESET’ signal if the execution process fails.
How does Microcontroller Work
To understand the working of a MCU, let us consider basic block diagram of simplest Automatic Alarm System as shown in the Figure 5 (a). This system is designed to beep hourly, using a Microcontroller and the Final Product would be expected to resemble Fig. 5 (b).
Fig. 5 – (a) Block Diagram of Automatic Alarm System (b) Final Product
Requirements or Specifications:
- 8051 Microcontroller
- Power Supply
- LCD Screen (Date and Day must be Displayed)
- Buzzer (Must beep for 10 sec and stop)
Power Supply is the Input and LCD screen along with Buzzer acts as Output for the system.
The system has to be set-up initially for proper functioning. The LCD is initialized, specific Pin modes are dedicated for the Inputs and Outputs. The Source Code is generated based on the requirements and loaded on to the Microcontroller.
To check for the proper execution of the system, Power Supply is turned on. The built-in circuitry regulates the supply voltage and outputs 5V. This illuminates the LCD screen.
On the display screen, current Time and Date is displayed. The system is programmed in such a way that the Buzzer beeps for 10 seconds after every hour and stops automatically.
Applications of Microcontroller
The applications of Microcontroller include:
- The devices which are incorporated with Touch-Sensing capabilities are designed using Microcontrollers like Portable Electronic Devices which include Smart Phones, Gaming Devices and Media Players, etc.
- Microcontrollers are used in remote controls, toys, medical devices and other Embedded Systems.
- They provide Automobile Solutions like controlling Anti-Lock Brake system and managing engine control system.
- Microcontrollers are used in Radar Speed Gun to detect the speed of an object.
- They are widely used in Consumer Products like Ovens, Refrigerator, Washing Machines, Air Conditioners and Vacuum Cleaners etc.
- Microcontrollers are used in Computers to control I/O functions.
- They are also used to store information for Database Management System.
Advantages of Microcontroller
The advantages of Microcontroller include:
- They consume less power.
- They are economical.
- Microcontrollers are smaller in size compared to Microprocessors.
- It has low Clock Speed.
- Use of Microcontrollers has reduced PCB size to a great extent.
- Microcontrollers are capable of handling Boolean functions.
- They are reliable and operate faster.
Disadvantages of Microcontroller
The disadvantages of Microcontroller are:
- Architecture of Microcontroller is more complex compared to Microprocessor.
- They cannot be re-programmed.
- Interfacing issues occur as not all Microcontrollers have analog I/O.