Microcontroller, 8051, AVR, and PIC Microcontrollers
Table of Contents
Microcontroller Overview:
A microcontroller is a small computer built on a single integrated circuit or chip and it contains the core processor, the memory and the input/output peripherals. The memory in the microcontroller is divided into two parts one is your RAM which is used during the execution of the code and other one is the flash memory in which your program code resides. So whenever you burn your program code into your microcontroller. It will go directly into the flash memory of your microcontroller. The basic difference between a microprocessor and a microcontroller is that the microprocessor has no on-chip memory and input/output peripherals. So microcontrollers are used everywhere where you want a task to be automated. They are used in your home appliances like washing machines, microwave ovens, air conditioners and mobile phones. They are also used in automation industrial automation artificial intelligence robotics and some years ago. They are not used for high voltage applications like home or industrial automation where we have to control the high voltages like 220 volt or above 220 volt because our generic relays or the electromechanical relays have a disadvantage of producing back EMF net can damage our microcontroller but as a time passed the solid-state relays come into the picture. the solid-state relays means the semiconductor relays in which MOSFETs and FETs are used for controlling the switching operation and the solid-state relays provides the optical isolation that optically isolates the high voltage. So they are preferred over the electromechanical relays.
Applications of microcontrollers:
There are some applications of microcontrollers they are also used in satellites missiles radars. They are playing a very important role in the technological development. So here is a general environment of microcontroller here some input devices are shown and some output devices are shown like a keypad switches push buttons, controlling the motors LEDs.
One example of using the microcontroller these are it is a LED dot matrix LED dot matrix are very popular means of displaying information as it allows both static and animated text and images. Here in LED dot matrix multiple LEDs are wired together in rows and column structure. In actual the dot matrix does not know that how to display a character like your LCD. LCD has a on chip microcontroller to understand the ASCII value. ASCII value that you are giving to your LCD through microcontroller so LCD understands the ASCII value and display the character but in LED dot matrix there is no such microcontroller that can receive directly the ASCII value and display the character. So in the LED dot-matrix we control the LEDs and make the process so faster by using the microcontrollers that it looks like that the characters are moving.
Second example of using the microcontroller in your home appliances like refrigerator here microcontroller is used for controlling the different operations of refrigerator. It is getting the temperature from some temperature sensor I see and by reading the temperature it is controlling your compressor. Now it is taking decision that whether to drive whether to run the compressor or not depending among the temperature inside temperature of the refrigerator. It is also used to generate some voices or alarms if the temperature gets high like in case you have opened the door of a refrigerator for a long time or it can display the internal temperature of the refrigerator on some LCD device.
Further you can connect it to some GSM modem device where it can send some SMS alerts to the user so it can do multiple tasks. Here is another example of using microcontrollers in your home automation there are some sensors interfaces to the microcontroller like LPG gas sensor temperature sensor the infrared sensors. The light sensors video or image sensor and by reading this data the microcontroller will process the input data and control some output operations like sending SMS alerts to the user through GSM or controlling the lights and fans by using the relays or generating some alarms or displaying some values on the LCD display.
8051 Microcontroller:
So here is our first microcontroller that is Intel’s 8051 that is based on a Howard architecture and RISC instruction set. These chips are used in a wide variety of control systems telecom applications robotics as well in the automotive industry and it is one of the most popular general-purpose microcontrollers that we use today and here is some basic information about the 8051 microcontroller and as it has 8 bit ALU and 16 bit address bus and 8 bit data bus 4 kilobytes of on-chip program memory which is 8 kilobytes in 8052 to 128 bytes of on chip RAM 32 input/output lines and full duplex UART and 6 interrupt sources. The 8051 on microcontroller is produced by many manufacturers some of them are Atmel, Intel, Philips which is an XP, sharp, Texas Instruments, maximum Dallas.
Here is a general architecture of 8051 microcontroller. These are the two most widely used microcontrollers of the ages of AI one family in which one is the AT89C52 that is from Atmel and another is P89V51RD2 which is from an XP Philips. One special feature of P89V51RD2 is X2 mode operation. normally all the micro controllers in 8051 in microcontrollers the clock rate is 12 clocks per machine cycle but by selecting the X 2 mode we can reduce it to 6 clocks per machine cycle. So although the 8051 microcontrollers are very popular and they are good but they are more advanced microcontrollers available from Atmel AVR.
So our first microcontroller 8051 microcontrollers has one serial communication channel that is USART for serial communication of data.
- Translates data from parallel to serial form on transmission end and vice versa
- Requires only 2 pins for operation in asynchronous mode
- Both the ends Tx and Rx most operate at same baud rate if communication is asynchronous
- Supports full duplex mode
Transmitter as communication is not synchronous the receiver and transmitter operate at same speed or same baud rate and the data byte is framed between these start and stop bits to indicate the start of data byte and end of data byte and you cannot connect more than two channels on the UART bus if we want a secure transmission.
I/O Ports:
The 8051 has four important ports. Port 0, Port 1, Port 2 and Port 3. These ports allow the microcontroller to connect with the outside world. Each port has 8 pins thus the four ports joint comprise 32 pins. All ports are bidirectional each port has a latch and driver. When external memory is employed the port 0 lines will function as multiplexed low byte address / data lines and port lines will function as high byte address lines.
AVR microcontroller:
AVR is a risk microcontroller based on modified Howard architecture. So it was developed by Atmel in 1996 and it is better than the 8051 microcontroller in many aspects. Firstly in the 8051 microcontroller you cannot set your input/output pins easily. in 8051 microcontroller if you are giving a high logic to any pin you are simply declaring it as input pin or if we are giving a logic 0 to any pin you are declaring a it has output pin but in the AVR microcontrollers there is a some special resistors to control the direction of the input/output pins and for giving the output value and reading the input value. There are two different resistors so it makes the operation easy and also most instructions in the AVR microcontrollers take just one or two clock cycles which makes the AVR microcontrollers fast among the present 8-bit microcontrollers has some features of the AVR microcontrollers that it has a internal power on reset circuit internal calibrated oscillators on chip Ram flash EEPROM or non-volatile memory and some resistors on chip Analog to digital converter comparator compatible with the SPI interface, 2-wire interface and compatible, USART, JTAG and CAN.
It is the architecture of the Atmel AVR. The AVR has an orthogonal instruction set orthogonal means that all the instructions can use all the addressing modes we can apply any operation on any resistor unit using any addressing mode. These are the families of AVR.
Tiny AVR:
ATtiny series from Atmel provides small size and less costly microcontrollers for small applications. But their performance is same as other AVR microcontrollers. They contain less memory, less I/O pins.
Mega AVR:
ATmega series is very popular. Most of the students use microcontrollers of this series for their projects. They are also used in industries. They have large memory size, more I/O pins and more number of inbuilt peripherals. They are designed for medium level application (ATMEGA 328).
Xmega AVR:
ATxmega series is designed for high and complex applications. Their memory size and speed is higher than ATmega series. This series provides DMA (direct access memory) feature. It also provides the peripheral devices to communicate without interrupting CPU. The XMEGA series also provides 16-bit microcontroller (ATmega 256). Atmel has also released its 32 bit microcontroller (AVR32) with advance feature which includes video and audio signal processing.
PIC microcontroller:
PIC microcontroller pic stands for the peripheral interface controllers or programmable interface controllers these are produced by the microchip technology. Firstly the PIC microcontroller was invented and developed by General instrument in 1975. At present PIC microcontrollers are one of the most extensively used microcontrollers due to tremendous features. These are also based on the power architecture and RISC instruction set and it also supports the orthogonal instruction set like at once AVR the pic microcontroller also has separate resistors for controlling the direction of input/output ports and giving the values at the output or reading the input values.
Features of the PIC microcontrollers:
Here are some important features of the PIC microcontrollers which are very similar to the AVR.
- Provides the internal power on Reset
- Internal calibrated oscillator
- On chip flash memory for program storage
- On chip RAM and flash memory more than 8051
- On chip EEPROM
- Analog to digital converter
- Digital to analog converter
- On chip analog comparator
- SPI interface
- compatible
- EUSART
- USB compatible
- CAN
The architecture of the microcontroller it is a little bit different from the other microcontrollers that are available today. Here instead of the accumulator resistor the W resistor is used. The difference between the accumulator and W resistor is its position. It is positioned in a different way than the accumulator in other microcontrollers accumulator is placed at the output of the ALU. So the result of ALU is always stored into the accumulator. However in pic microcontrollers we can store the result either in W resistor or in any other resistor of the data memory also the arrangement of stack memories different in pic microcontrollers here stack is not a part of data memory or your RAM stack memory has its own independent space therefore it has some finite size and this finite size of stack memory depends upon the different pic models that are available. One another different feature of pic is that they do not have the stack pointer resistor as it is commonly available in most microcontrollers. PIC microcontrollers and AVR microcontrollers use the pipelining technique for the execution of instructions. in pipelining technique the next instruction is fetched during the current instruction is being executed so it makes the operation faster. these are some families of the pic microcontrollers.
They are divided into three categories:
Low end microcontrollers:
- Instruction set of 33 instructions
- 12 bit instruction size
- No interrupts
Medium end microcontrollers
- Instruction set of 35 instructions
- 14 bit instruction size
- Support few internal interrupts and one external interrupts
High end microcontrollers
- Instruction set of 58 instructions for PIC17 and 77 instruction for PIC 18
- 16 bit instruction size
- Support few internal interrupts and external interrupts
They can also be classified as in thus in the form of series like pic 10 series pick 12 pic 16 pic 18 advanced pic 18 pic 24 pic 32.
PIC 24:
- Series of 16 bit microcontroller
- Instruction size is 24 bit
- Supports digital signal processing
- 118 interrupts sources
PIC 32:
- Series of 32 bit microcontroller
- On chip temperature measurement
- Cryptography
- Supports audio and graphics interface
- Supports digital signal processing
- Operating frequency 40 MHz – 200 MHz
- 5 stage pipeline process