What is a Microcontroller? Types, Works, Uses & More

5
57
What is a Microcontroller

What is a Microcontroller?

A microcontroller refers to the smallest computer that can be used on an Integrated Circuit or IC. They have memory of their own, one or more small processors and programmable I/O, all on a single chip.

Technically, a microcontroller is a compact integrated circuit designed to perform specific operations in an embedded system.

KEY TAKEAWAYS

  • A microcontroller is an integrated circuit or a small computer that has all the elements, properties, and functionalities of a computer designed to perform specific operations.
  • These special-purpose computers are embedded in a device and control its actions using a program stored in the Read Only Memory or ROM, which is usually unchangeable.
  • These are typically low-power devices designed by Intel in 1971 with major components including RAM, ROM, CPU, and input and output ports.
  • Microcontrollers are used extensively in most of the electronic industry, especially the computer industry due to its wide range of applications from cars to microwave ovens, and from robots to washing machines.

Understanding Microcontroller

Understanding Microcontroller

A Microcontroller Unit, or MCU, is also called an embedded controller or embedded computer sometimes because these are compact ICs that act as small, independent computers.

The architecture of a microcontroller is usually based on the Harvard architecture that offers different ways to exchange data between the memory and the processor.

Some are designed on Von Neumann architecture as well that offer similar benefits.

The processors in them can be based on reduced instruction set computing or complex instruction set computing.

If it is based on complex instruction set computing, it will typically have the following:

  • About 80 instructions
  • About 12 to 24 addressing modes.

If it is based on reduced instruction set computing, it will typically have:

  • About 30 instructions
  • About 3 to 5 addressing modes.

Complex instruction set computing, however, emphasizes more on hardware and is much easier to implement than reduced instruction set computing.

It also allows more efficient use of memory with a higher number of clock cycles to execute instructions, although this may result in performance degradation.

Reduced instruction set computing, on the other hand, focuses more on software and therefore offers much better performance as compared to the reduced instruction set computing.

This is because it has a much simpler instruction set and design. However, the software can be quite complex.

The MCUs can perform a number of peripheral functions due to the input and output pins in them. These pins let the microcontrollers act as follows:

  • Analog to Digital Converters or ADCs
  • Liquid Crystal Display or LCD controllers
  • Universal Synchronous/Asynchronous Receiver Transmitter or USART
  • Universal Asynchronous Receiver Transmitter or UART
  • Real Time Clock or RTC
  • Timers
  • Universal Serial Bus or USB connectors.

The features of the microcontrollers make them preferred and popular, comprising about half of the entire processor market across the globe.

Some of its useful features are:

  • The processors in them may vary from the simple 4-bit, 8-bit and 16-bit processors to more advanced 32-bit processors.
  • There is volatile memory such as Random Access Memory or RAM in them as well as non-volatile memory such as Erasable Programmable Read Only Memory or EPROM, Electrically Erasable Programmable Read Only Memory or EEPROM, and flash memory.
  • They are readily usable without needing added computing components since they can perform general I/O operations with the pins in them that directly interface with the sensors and other parts.
  • There are several sensors attached to the microcontrollers that can collect data related to temperature, humidity, and others.
  • A microcontroller device can have longer words, ROM to store programs and RAM to store data.

What is a Microcontroller

Microcontroller Types

There are different types of microcontrollers available that are categorized based on different factors such as architecture, bit configuration, bus width memory, instruction set, and so on.

Based on bus width, the microcontrollers can be classified as:

  • 8-bit microcontrollers such as the Intel 8031, 8051 and the PIC1x
  • 16-bit microcontrollers such as the 8051XA, PIC2x and Intel 8096
  • 32-bit microcontrollers such as the Intel/Atmel 251 family and PIC3x,

Based on memory, the microcontrollers can be classified as:

  • Embedded memory microcontrollers
  • External memory microcontrollers.

Based on Instruction Set Architecture, the microcontrollers can be classified as:

Based on their architecture, the microcontrollers can be classified as:

  • Harvard architecture microcontrollers
  • Von Neumann or Princeton architecture microcontrollers.

There are also some other types of microcontrollers that are commonly used, such as:

PIC microcontrollers, with features as follows:

  • 40-pin IC in DIP packaging
  • 33 pins available for I/O
  • No internal oscillator
  • External clock up to 20 MHz
  • No internal clock
  • Smaller instruction sets of 35
  • Lower operating voltage ranging from 4.2 volts to 5.5 volts.

8051 microcontrollers, with features as follows:

  • 8 bits
  • 40-pin DIP packaging
  • 32 pins available for I/O
  • 4 KB on-chip, programmable ROM
  • 128 bytes of on-chip RAM.
Read Also:  What is Server? Types, Uses, Function & More

AVR microcontrollers, with features as follows:

  • An internal oscillator of 8 MHz
  • 1 KB on-chip, programmable ROM
  • 32 KB of on-chip RAM
  • 4 PWM or Pulse Width Modulation channels
  • Two 8-bit timers
  • One 16-bit timer.

ARM microcontrollers, with features as follows:

  • 32-bit RISC Cortex M0 processor
  • Harvard architecture.

RENESAS microcontrollers, with features as follows:

  • CISC Harvard architecture
  • 8-bit and 16-bit or 32-bit
  • Low power
  • RAM ranging from 2 KB to 128 KB.

How Do Microcontrollers Work?

The microcontrollers typically work by processing the data received by the input pins with the help of the CPU. The final result of the processing is given through the output pins.

Basically, the entire working process of the microcontroller is executed and driven by the synchronous sequential logic circuit. This has specific features such as:

  • A simple design
  • Output depends on present as well as past input history
  • The state of the device changes when decided by the cock signal only at discrete timing.

The MCUs also use a large number of logic gates for processing data.

These gates usually need some time to alter the output state. It depends on the inputs. This is called propagation delay.

The interval between every clock pulse must be higher than this delay.

This will make the logic circuit more reliable and stable since it decides the highest operating speed of the microcontroller, which may be different from one MCU to another.

The working process of the microcontroller can be summarized as follows:

  • Data is received by the input pins from the I/O peripherals
  • It is stored in the data memory temporarily
  • The central processor accesses it
  • It is deciphered by the CPU by using the instructions stored and available in the program memory
  • Communications are made through the I/O peripherals for enacting the right action.

The process is completed in quick time since the microcontrollers are high-speed devices. This is ensured by the workings of the other components as follows:

  • The control logic register enables the quartz oscillator when power is supplied to it
  • Parasite capacitors are recharged for just a couple of seconds during the initial preparation stage
  • The special function registers become stable while performing the operation of writing bits
  • The frequency of the oscillator stabilizes when the voltage level is at its maximum.

The whole thing is regulated by the clock of the oscillator and everything happens in a matter of a few nanoseconds when the device starts to function.

What is a Microcontroller Used for?

Microcontrollers have a wide range of applications, ranging from communication to motor control, industrial to medical and test and measurement applications.

It is also used in different embedded systems, office machines, home appliances, remote-controlled appliances, and electromechanical systems.

Depending on their sophistication, some of the applications of the MCUs are:

  • Robots
  • Motor vehicles
  • Industrial automation
  • Manufacturing industries
  • Lighting
  • Internet of Things
  • Smart energy
  • Communications
  • Digital signal processors such as analog-to-digital and digital-to-analog converters
  • Microwave ovens
  • Toasters
  • Refrigerators
  • Mobile devices
  • Key fobs
  • Video game systems
  • Computers
  • Televisions
  • Lawn-watering systems
  • Photocopiers
  • Scanners
  • Printers
  • Fax machines
  • Smart meters
  • Security systems
  • ATMs
  • Aircrafts
  • Spacecrafts
  • Different vehicles
  • Ocean-going vessels
  • Medical appliances and life-support systems
  • Smartphones
  • Tablets
  • Different computer peripherals
  • SoCs or System on Chips
  • LPWANs or Low Power Wide Area Networks
  • Toys
  • Cameras
  • Washing machines
  • Multimeters
  • Oscilloscopes
  • Leakage current testers
  • Security alarms
  • Data Acquisition and Control
  • Safety and fire detection devices
  • ECG
  • Answering machines
  • Mp3 players
  • PDAs or Personal Digital Assistants
  • Speedometers
  • Auto-braking systems
  • Voltmeters
  • Current meter and lots more.

Therefore, the MCUs are used in a wide range of devices to control the small features of the larger components.

It is due to the unique aspect of the microcontrollers, which is that they do not need a multifaceted, front-end operating system.

Microcontroller Examples

Any self-contained system that comes with its own memory, processor, and peripherals can be an example of a microcontroller.

Usually, you will find them in embedded systems and other machinery, such as computers and their peripherals, automobiles, telephones, and appliances.

Here is the list, in alphabetical order, of some of the most common and widely used microcontrollers produced by different manufacturers:

  • Altera
  • Analog Devices
  • Atmel
  • Cypress Semiconductor
  • ELAN Microelectronics Corp
  • EPSON Semiconductor
  • Espressif Systems
  • Freescale Semiconductor
  • Fujitsu
  • Holtek
  • Hyperstone
  • Infineon
  • Intel
  • Lattice Semiconductor
  • Maxim Integrated
  • Microchip Technology
  • National Semiconductor
  • NEC
  • Nuvoton Technology
  • NXP Semiconductors
  • Panasonic
  • Parallax
  • Rabbit Semiconductor
  • Redpine Signals
  • Renesas Electronics
  • Rockwell
  • Silicon Laboratories
  • Silicon Motion
  • Sony
  • Spansion
  • STMicroelectronics
  • Texas Instruments
  • Toshiba
  • Ubicom
  • Xilinx
  • XMOS
  • ZiLOG

What are the Components of a Microcontroller?

There are mainly three core components of a microcontroller such as the CPU, I/O peripherals and memory along with some additional supporting elements that help in its functioning.

The fundamental elements of a microcontroller are:

The processor or CPU – This, being the brain of the MCU, responds to different instructions and processes them. The instructions include basic arithmetic, logic and I/O functions along with data transfer to communicate commands to the other parts of a larger embedded system.

Memory – This is used to store the data received by the processor of the microcontroller temporarily. There are actually two main memory types in a microcontroller.

There is a non-volatile program memory that stores long-term information regarding the instructions carried out by the CPU without requiring a power source.

And, there is a volatile data memory to store data temporarily while an instruction is being executed and requires a stable power supply.

Read Also:  8 Differences Between EIDE and IDE

I/O peripherals – These act as the interface for the CPU to receive information from the outside world through the input ports and send it to the output devices in the form of binary data to complete the tasks that are external to the MCU.

In addition to these defining elements, the microprocessor also comes with some other additional elements included in it. These are:

ADC or Analog to Digital Converter – This is a circuit that changes analog signals to digital signals which lets the processor communicate with the sensors and other similar external analog devices.

DAC or Digital to Analog Converter – This circuit changes the digital signals to analog signals and helps the processor convey the outgoing signals to the external analog devices.

System bus – This is the communication pathway or the wire that connects all the different parts of the MCU together.

Serial port – This is an I/O port that allows the MCU to connect to other outside components. It functions in the same way as a parallel port or USB with the only difference being the ways of exchanging bits.

Timers and counters – The counter is used to manage the counting of the external pulses. The timer conducts different clock tasks and times different functions of the microcontrollers such as pulse production and modulations, oscillations, frequency measurement, and others.

Interpretation controller – This is used to supply delayed control with both internal and external interpretation to the running application.

Block with special function – This block with additional ports is found in a few specific types of microcontrollers used in special devices such as robots, space systems and others to perform specific types of tasks.

How is a Microcontroller Programmed?

Typically, the microcontrollers are programmed in three basic steps involving writing the code, compiling the code files and uploading it.

In the earlier days assembly languages were used for programming but the modern MCUs are programmed using higher-level languages such as Java and C++.

The basic steps involved in programming a microcontroller are:

Writing the program code – This is the first step of programming and is usually done in C, though some compilers prefer using other programming languages as well.

You may use any software to write the code, even Notepad, but choosing a better version such as Notepad++ that supports highlighting the syntax will make writing much easier.

Compiling – This is the second step to follow which involves converting the human-readable code into a machine-readable code. There may be one or more files to compile before you upload the code for the microcontroller.

Uploading the file – While uploading the program file for the EEPROM or flash, you will need a physical connection to the microcontroller from the computer and a dedicated programmer or a USB programmable chip.

How is a Microcontroller Powered?

Ideally, the microcontrollers are powered by any of the three main DC voltage sources such as wall adapters, batteries, or via the USB port in the computer.

Wall adapter – Also called wall-warts, these big and bulky adapters protrude like a wart. One with an output voltage corresponding to that of the devices in the circuit should be used. However, if it is higher than that, you will need to use a voltage regulator along with it as well.

Batteries – There are different types of batteries with varied voltage ratings and therefore one with the desired voltage should be used.

However, you must also consider the periods of operation so that it can supply the rated output to the circuit. Once again, if the rating is higher than what is desired, it will also need using a voltage regulator.

USB – This is perhaps the best power source and the easiest way to get a smooth supply of 5 volts of direct current.

The amount of power required by a microcontroller is determined by the needs of the device but usually it is within a specific range.

Advantages

  • Faster operation
  • Easy to use
  • Simple troubleshooting
  • Straightforward system maintenance
  • Small size
  • More adaptable
  • Low cost
  • Easy to interface supplementary RAM, ROM, and I/O port
  • Wide range of applicability
  • Less complicated design
  • Low consumption or power
  • Less heat generation
  • Can be used in compact and embedded systems
  • Easy to investigate errors and resolve
  • Available in a wide variety
  • Does not need any operating system to function
  • Easy connectivity to other devices
  • Internet connectivity not required and hence lower security issues
  • Programmable Read Only Memory or PROM prohibits reprogramming a programmed MCU
  • Several tasks can be performed that reduce human efforts
  • Can perform as a microcomputer without any digital parts
  • Higher integration
  • Useful features

Disadvantages

  • Not suitable to use in larger equipment due to their smaller size
  • Complex structure
  • Inability to directly interface a high-power device due to slower speed
  • Limited number of executions
  • Less durable since the Complementary Metal Oxide Semiconductor or CMOS can be damaged due to a static charge
  • Cannot access multitasking devices
  • Can handle only one task at a time
  • Cannot be reprogrammed
  • No zero flags
  • No operating system installed

Microcontroller vs Microprocessor

  • There are no zero flags in a microcontroller as opposed to a microprocessor
  • Microcontrollers are less expensive than microprocessors
  • MCUs consume less power than the microprocessors
  • Microcontrollers have RAM, ROM and I/O peripherals built in them but microprocessors do not have them and instead connect to them with their pins
  • The MCUs are the heart of the embedded systems but a microprocessor is the heart of the whole computer system
  • The internal circuit of a microcontroller is smaller in comparison to that of a microprocessor
  • Microcontrollers are low-cost in comparison to microprocessors
  • MCUs usually provide power-saving modes but microprocessors do not offer such modes
  • The application of the microcontrollers is over and above that of personal computers while that of the microprocessors is not as wide and varied
  • The microcontrollers are typically based on Harvard architecture but the microprocessors are typically built on Von Neumann architecture
  • The microcontrollers usually run at a lower speed of up to 200 MHz depending on their architecture and features as compared to the microprocessors which can run at a very high speed
  • The microcontrollers are application-specific but the microprocessors are for general-purpose use
  • Microcontrollers usually have fewer instructions but microprocessors have a large number of instructions
  • Microcontrollers are easy to replace but the microprocessors are not
  • External peripherals are not needed in microcontrollers but in microprocessors these are needed to be connected externally
  • Programs are much easier to write due to the higher number of registers in the microcontrollers as opposed to the microprocessors
  • Microcontrollers cannot be used for intensive processing while the microprocessors can be used
  • The clock speed of the microcontrollers is lower, usually ranging between 1 MHz and 300 MHz as opposed to 1 GHz to 4 GHz or more in the microprocessors
  • The amount of RAM in microcontrollers ranges between 2 KB to 256 KB but in a microprocessor the same can range between 512 MB and 32 GB
  • The amount of ROM in the MCUs is usually between 1 KB and 256 KB but that of the microprocessors ranges between 128 GB and 2 TB
  • The common peripheral interfaces of the microcontrollers are I2C, SPI, and UART but those of the microprocessors are USB, UART, and high-speed Ethernet
  • Programming a microcontroller is easier, but in comparison, programming of the microprocessors is quite complex
  • Once programmed, the microcontrollers cannot be reprogrammed, unlike the microprocessors
  • The microcontrollers are available in 8-bit, 16-bit and 32-bit versions but the microprocessors are available in 32-bit and 64-bit variants.
Read Also:  Firewall vs IDS vs IPS: 10 Differences

Why are Microcontrollers Preferred?

Microcontrollers are preferred because they are specially designed and optimized to perform specific tasks while using very little power.

These are also ideal for use in embedded systems as well as for common computing applications since they can support more versatile and complex computing operations depending on their capabilities and instruction sets.

Questions & Answers:

Do Microcontrollers Have Logic Gates?

Yes, the microcontrollers are, in fact, made up of thousands, and even millions, of logic gate circuits.

Does a Microcontroller Store Data?

Yes, the microcontrollers store data in the data memory. Usually, the microcontrollers come with their own RAM to store the data of the running programs.

However, it is volatile and stores data temporarily or as long as there is a constant power supply.

How Much RAM Does a Microcontroller Have?

The amount of RAM in a microcontroller is usually around 128 bytes or 1 MB to 256 KB, which is not very big to hold a lot of RAM for your application.

However, you should check with the data sheet of the MCU to be doubly sure about the amount of RAM.

How Much ROM is in a Microcontroller?

The amount of ROM in a microcontroller is much higher than the amount of RAM in it. For example, in an 8051 microcontroller the amount of ROM or code memory is 4 KB. Typically, in general MCUs, the amount ranges between 32 KB to 2 MB.

What is the Voltage of a Microcontroller?

Most of the microcontrollers may run at a voltage of 3 volts, while there are a few that can operate even at a lower voltage supply of less than 2 volts.

Typically, the modern microcontrollers consume significantly low power to operate. In fact, their operating voltage typically ranges between 1.8 volts and 5.5 volts.

Is a Microcontroller an IC?

Yes, a microcontroller is a single Integrated Circuit or IC. It is designed to perform special tasks and is intended to be used for a particular application.

Which Language is Best for a Microcontroller?

Microcontrollers were initially programmed in assembly language only, but today, the most popular option is the C programming language. The most commonly used languages used in the microcontrollers are C or C++.

These are reliable and can ensure higher efficiency and speed in performance. Apart from that, MCUs can also be programmed in other common languages such as JavaScript and Python.

Conclusion

Microcontrollers are used in almost all electronic devices today, including computers.

They offer a much more practical, flexible and affordable solution to meet several challenges in modern systems and their circuit design.

Designed to perform specific tasks, they add to the overall performance of the system.

About Dominic Chooper

AvatarDominic Chooper, an alumnus of Texas Tech University (TTU), possesses a profound expertise in the realm of computer hardware. Since his early childhood, Dominic has been singularly passionate about delving deep into the intricate details and inner workings of various computer systems. His journey in this field is marked by over 12 years of dedicated experience, which includes specialized skills in writing comprehensive reviews, conducting thorough testing of computer components, and engaging in extensive research related to computer technology. Despite his professional engagement with technology, Dominic maintains a distinctive disinterest in social media platforms, preferring to focus his energies on his primary passion of understanding and exploring the complexities of computer hardware.

Previous articleMeltdown and Spectre Vulnerabilities Explained
Next articleWhat is Memory Dependence Prediction? (Explained)
Dominic Chooper
Dominic Chooper, an alumnus of Texas Tech University (TTU), possesses a profound expertise in the realm of computer hardware. Since his early childhood, Dominic has been singularly passionate about delving deep into the intricate details and inner workings of various computer systems. His journey in this field is marked by over 12 years of dedicated experience, which includes specialized skills in writing comprehensive reviews, conducting thorough testing of computer components, and engaging in extensive research related to computer technology. Despite his professional engagement with technology, Dominic maintains a distinctive disinterest in social media platforms, preferring to focus his energies on his primary passion of understanding and exploring the complexities of computer hardware.
5 Comments
Oldest
Newest
Inline Feedbacks
View all comments