[otw_is sidebar=otw-sidebar-1]I am quite excited to start a new series of articles in which I will discuss about the nitty gritty of microcontrollers, about what the microcontroller is, difference between microcontroller and microprocessors and most importantly the vast applications of the microcontroller. I will try to cover all the details of the microcontrollers regarding firmware and hardware in this series of articles.
So, sit back keep reading and enjoy learning.
Introduction to Microcontroller :
If you are into electronics you must have heard the word “Microcontroller” and you want to know more about the microcontroller that is why you are here J. But don.t worry I will keep it simple. So, the simplest definition of the microcontroller I have come u is that the microcontroller is the device that runs the program to carry out a particular task; the task could be driving the motor, turning on and off the LEDs or controlling the relays etc. Thinking about the program! The program is the set of instructions that is stored in the code memory of the microcontroller and when the microcontroller powers up it executes this program and carry out the function depicted by the program. Most of you must be wondering how the program is executed in the microcontroller well this is the most interesting question that I have been ever asked J. But to this point we will not go into the detail on the discussion of the program execution but I would like to tell you that formal word used for the process of program execution is execution cycle. If anyone is interested they can look but I would suggest reading this article first.
A microcontroller has different peripherals available on chip, by peripheral it mends different hardware manufactured on the microcontroller for different applications as an example consider the following:
Timer circuit in the microcontroller which is the peripheral used for PWM signal generation is one of the important peripherals.
In addition to timer there are interrupts which are used for different applications such as you may need the project which needs to monitor some type of signal or trigger any device in response to trigger of another event. This is achieved using the interrupt, when the microcontroller receives the Interrupt signal then it executes the special type of code called the Interrupt Service Routine also known as ISR.
Power on Reset (PoR):
Another important peripheral available on the microcontroller is the Power on Reset (POR) circuitry. It is an important circuitry some microcontrollers have built in Power on Reset and some have to rely on external Power on Reset circuitry, but most of the modern microcontrollers have built in Power on Reset. I will not dive into the detail of the Power on Reset circuitry at this point but it is to be mentioned that the Power on Reset Circuitry ensures the successful power up of the microcontroller if the Power on Reset circuitry failed to play its role then the microcontroller will boot successfully.
Brown out Reset (BoR):
Brown out Reset is another important peripheral of the microcontrollers; most modern microcontrollers are equipped with Brown out Reset Circuitry (BOR). This peripheral ensures the safe operation of the microcontroller under low voltage conditions.
Inter Integrated Circuit (I2C):
As most of us know the most popular applications of the microcontroller is in the embedded systems. In the embedded applications the hardware designer usually came across the situation where he / she need to let two devices communicate. Nowadays, microcontrollers are equipped with serial communication peripherals that let the microcontroller to communicate with other ICs or modules. One of the most popular serial communication peripheral available in the microcontrollers is I2C bus. I2C bus is the two wire one wire is used to send / receive the data and one is the clock signal which is used to synchronize the communication.
Universal Asynchronous Receiver / Transmitter (UART):
UART is another popular communication peripheral available in the microcontroller as the name suggests UART implements asynchronous serial communication. UART employs two wires one to send the data another to receive.
Serial Peripheral Interface (SPI):
Like I2C, SPI (Serial Peripheral Interface) is the synchronous serial communication peripheral that is also available on most microcontrollers.
Above explained briefly are the most popular peripherals of the microcontroller that you will usually encounter while working with the microcontrollers and a sound knowledge of these and other peripherals make you an expert in microcontrollers.
Types of Microcontrollers:
Microcontrollers are available in vast categorize, the microcontrollers can be classified on the basis of the type of core on which they are based but here the classification of the microcontrollers will be considered on the basis of the manufacturers of the microcontrollers.
Three most popular types of microcontrollers are:
- AVR microcontroller.
- PIC microcontroller.
- STM microcontroller.
These microcontrollers are manufactured by different manufacturers and have their similarities and differences. Microcontroller share most of the features for example the all of the above mentioned types of microcontrollers have Inter Integrated Circuit (I2C) Bus, they all have Serial Peripheral Interface (SPI), they all have UART and other peripherals are also common to these microcontrollers. The main difference between the microcontrollers is the instruction set, all of the above mentioned microcontrollers types have unique instruction set, this is the reason that the program written for one microcontroller type cannot run on the other microcontroller type. One main similarity among these microcontrollers is that all of them are based on ARM (Advanced Reduced Instruction Set Computing Machine) cortex.
The following figure shows the pinout of the ATMEGA 32 microcontroller.
Let us now discuss some important information about the programming of the microcontroller. Recall from the previous discussion where I mentioned that the microcontroller executes the program which is composed of different instructions written in the programming language and thus perform the intended task. In this chapter we will discuss about programming of the microcontroller.
A microcontroller can be programmed in a variety of ways for example one can program the microcontroller using the USB to UART converter, some microcontrollers can be programmed using the ISP (In System Programming), some microcontrollers can also be programmed using SWD (Serial Wire Debug) interface. Similarly some microcontrollers can be programmed using JTAG. The program for the microcontroller is written in the editor, then compiled using the compiler and then uploaded to the flash of the microcontroller using the appropriate software. Nowadays programmers use the Integrated Development Environment (IDE) for programming the microcontrollers which comprise the editor, compiler and programmer all under one roof.
The following figure shows the FTDI breakout which a USB to serial converter, this breakout board is used to program the microcontroller via UART.
Another programming device is the PICKIT which is used as In system Programmer to program the microcontroller.
Let us touch the execution cycle at this point briefly. As I stated that the program is a set of instructions these set of instructions when uploaded to the microcontroller resides in the code memory of the microcontroller. Each memory location of the code memory of the eight bit microcontroller can store a byte (8 bits) and is assigned a unique address. When the microcontroller starts to execute the program the program counter of the microcontroller points to the location of the address of the code and then retrieve the bits stored on that location. This binary data is then taken into the instruction decoder which decodes the instructions and let the microcontroller execute the intended task. It is important to note at this point that the maximum size of the code that the microcontroller can store depends on the program counter can anyone tell how, come in the comment box and let us discuss.
Applications of microcontrollers:
Let us now discuss the most interesting chapter about the microcontroller that is the applications of the microcontrollers. Microcontrollers have a variety of applications a microcontroller can be found in consumer electronics, home electronics, and industrial products, embedded products such as calculator, microwave oven, washing machine, home automation system, automatic gate openers, and security systems. Microcontrollers also found applications in large systems where they are intended to perform a small operation as a contribution to the overall system as an example consider the inverter based on the microcontroller where a microcontroller is used to monitor feedback signal from the system and then regulate the voltage or current accordingly.
Microcontrollers can be hooked up with other modules and thus found application in other areas. For example if a WiFi module is attached to the microcontroller then it is used in IoT products, for example consider the Greenhouse Monitoring System which is an IoT enabled product where a microcontroller is interfaced with different sensors and collect information about the environmental conditions of the greenhouse. This information is then uploaded to the URL cia a WiFi module attached to the microcontroller. Similarly a surveillance system is also IoT product based on the microcontroller hooked up with the WiFi module.
Similar to the WiFi module the microcontroller when interfaced with the BLE (Bluetooth Low Energy) enabled module opens a new field of products. For example the microcontroller interfaced with the BLE chip founds applications wearable products, portables health monitor products. One of the most popular applications of the Bluetooth Low Energy is the Beacons.
Microcontroller hooked up with the GPS module finds application in the asset tracking system. Similarly the microcontroller together with the GSM module has its unique set of applications. As a summary the microcontroller applications are vast and one can develop the microcontroller based product as desired.
Microcontroller Block Diagram:
As mentioned in the introduction chapter that the microcontroller has several peripherals each with unique set of applications. Let us now have a look at the architectural block diagram of the microcontroller.
The detailed architectural block diagram of the AVR microcontroller is shown in the following figure:
As shown in the above block diagram that the different peripherals of the microcontroller inside it are connected to the CPU through the bus. The microcontroller has the code memory and data memory inside it as shown the code memory is used to store the program inside the microcontroller and the data memory is used to store the data received from the serial communication interfaces and the Input / Output ports. As shown in the above figure that the microcontroller also has the Analog to Digital Converter peripheral which is used to interface the analog signals to the microcontroller, these analog signals could be the signal from the temperature sensor, light sensor or the signal from some kind of the filter or amplifier.
That is all for now, I hope this article would be helpful for you and you might have learnt a lot. I have tried to explain simply and briefly all the introductory concepts, in the next article of the series I will discuss in detail about different types of microcontrollers. Stay connected, keep reading and enjoy learning.
A complete step by step tutorial on the Microcontroller for Beginners