What is a Microcontroller ?
- 1 How does it works ?
- 2 Elements of a Microcontroller
- 3 Why do we need Microcontroller ?
- 4 Applications
- 5 Different Microcontrollers
- 6 Advantages
A microcontroller is an integrated circuit (IC) which is small, low cost and self contained computer designed to handle a specific task in embedded systems. In simple words, a microcontroller (MCU or Microcontroller Unit) is a small computer integrated in to a single chip. We can also explain it as programmable silicon chip which is clock driven, register based, accepts input and provides output after processing it as per the instructions stored in the memory.
A computer is a general purpose device which we can use for word processing, watching movies, editing videos, web browsing, developing softwares etc. While a microcontroller is intended to do some specific tasks like controlling a washing machine, controlling an air conditioning etc.
Recommended reading : What is a Microprocessor ?
How does it works ?
A microcontroller processes data given to it’s input pins using it’s CPU and gives output via output pins. It executes or driven by a synchronous sequential logic circuit.
As per digital circuits theory, a sequential circuit is a logical circuit whose output not only depends on present inputs but also on past input history. And in synchronous sequential circuits, the state of the device changes only at discrete timing decided by a clock signal. The main advantage of a synchronous system is it’s simplicity when compared to an asynchronous system.
Hope you know about propagation delay. A microcontroller uses enormous amount of logic gates to process data. These gates require some time to change their output state depending on their inputs, which is termed as propagation delay. So the interval between each clock pules should be greater than this propagation delay to make the logic circuit stable and reliable. So this determines the maximum operating speed of a microcontroller, which will vary across microcontrollers.
Elements of a Microcontroller
As we explained above, a microcontroller is embedded with different elements like CPU, RAM, ROM etc.
CPU is analogous to processor in a computer, which basically consists of Arithmetical and Logical Unit (ALU), Control Unit and Register Array. As the name indicates ALU performs all arithmetic and logical operations on the data received from input devices or memory. Register array consists of a series of registers like accumulator (A), B, C, D etc. which acts as temporary fast access memory locations for processing data. As the name indicates, control unit controls the flow of instructions and data throughout the system.
RAM stands for Random Access Memory. Similar to a computer, RAM is used to store data dynamically while the microcontroller is executing instructions. It is a volatile memory, means when the power goes off all data is gone.
ROM or Program Memory
ROM stands for Read Only Memory. In old microcontrollers flash memory was one time programmable that is why it is called ROM. But in latest microcontrollers it is re-programmable, ie. EEPROM (Electrically Erasable Programmable Read Only Memory). ROM is used to store the program or instructions which needs to be executed.
Input Output Ports (I/Os)
Microcontrollers provide multiple general purpose input output (GPIO) pins which can be configured as an input or output pin by writing to particular configuration registers. This pins can read or write HIGH or LOW state from/to it’s pins, making it possible to interface with external world.
A microcontroller requires clock as it executes and driven by sequential logic as explained above. Clock source can be external like crystal oscillator or internal like RC oscillator. Different microcontrollers will have different options for clocking. Some advanced microcontrollers even provide internal PLL (Phase Locked Loop) or FLL (Frequency Locked Loop) to multiply clock to higher frequencies.
Microcontrollers will also have other peripherals as below.
- UART, SPI, I2C for serial communication.
- Capture/Compare/PWM modules
- Analog to Digital Converter
Why do we need Microcontroller ?
A microcontroller can be programmed to do a specific task based on it’s instruction set and capabilities. Sometimes solutions are very complex, circuits also becomes very complex if we try to solve it only using hardware.
Imagine you want to make a big building, using BRICKS will make the construction process simple and cost effective. And it will also give you the freedom to make the building in shape and size what you like. Instruction set in a microcontroller are the bricks which you can use to solve your problem. By using those instructions you can easily solve complex program.
Just pause reading and look around in your house. You can see TV, TV Remote, Set Top Box, Microwave Oven in your Kitchen, Washing Machine, Air Conditioner and the car parked inside your porch etc., everything uses a microcontroller.
There are different microcontrollers available in the market manufactured by different companies.
8051 microcontroller series is the one of the most popular general purpose microcontroller. It is first manufactured by Intel. Nowadays we can see a lot of clones of 8051 microcontrollers with difference in RAM, ROM, Peripherals etc., manufactured by different companies like Atmel, Texas Instruments, Philips, Infineon etc. 8051 series microcontrollers is a popular choice among hobbyists and educational purposes.
PIC stands for Peripheral Interface Controller. It is a series of microcontrollers manufactured by Microchip Inc. It is popular among professionals, students and electronics hobbyists. It is low cost and commonly available in the market, also comes in 8-bit, 16-bit and 32-bit architectures.
ARM stands for Advanced RISC Machine, it is a reduced instruction set computer (RISC) microcontroller. ARM microcontrollers are the most popular among professionals. ARM microcontrollers are manufactured by different companies like NXP Semiconductors, STMicroelectronics, Microchip Inc., Atmel etc.
AVR microcontrollers are common among hobbyists and students. AVR microcontrollers are developed by Atmel, later acquired by Microchip. The popular Arduino boards uses AVR microcontroller.
In contrast to a computer microprocessor, a microcontroller is intended for some specific tasks. So the hardware requirements like RAM, ROM and other peripherals are very less. Thus everything is embedded into a single chip, by reducing the overall size very much.
Microcontrollers are very cheap when compared to microprocessors since the microcontroller it having less RAM, ROM, peripherals embedded into a single chip.
Less Power Consumption
Power consumption is very less as a microcontroller uses smaller set of hardware like RAM, ROM, other peripherals embedded in to a single chip.