Hi Guys! We are here to keep you uploaded with useful information so you keep coming back for what we have to offer. Today, I am going to unlock the details on the Introduction to Microcontrollers
. Microcontroller is an electronic device which is capable of doing various task efficiently in automatic control systems. It consists of memory, I/O ports and processor. We use C and assembly language to program the microcontroller
. It is like a tiny computers that helps to ease our tasks with the help of programming used inside compact circuitry. I'll try to cover each and every aspect related to microcontroller
so you get a clear idea what it does and what are its main applications. Let's hope on the board and explore microcontroller properties one by one.
Introduction to Microcontrollers
- Microcontroller is a compact tiny computer that is fabricated inside a chip and is used in automatic control systems including security systems, office machines, power tools, alarming system, traffic light control, washing machine, and much more.
- It is economical programmable logic control that can be interfaced with external devices in order to control the devices from a distance.
- First microcontroller was made by Michael Cochran and Gary Boone.
- It was specially built for embedded system and consisted of read write memory, read only memory, I/O ports, processor and built in clock.
- C and assembly languages are used to program the microcontrollers.
- There are also other languages available to program the microcontroller but at the start learning a microcontroller programming with C and assembly language is a great choice, both are easy to learn and provide a clear concept about microcontroller.
- Technology have been evolved in an amazing way and made our lives easier more than ever before.
- Few years ago making the elevator in running condition was a hell of task which involved complex programming and circuitry.
- Now, you are capable of not only controlling elevator from microcontroller but you can also move the submarine with the proper instructions directed into a single microcontroller.
- Any application which involves measuring, controlling, and displaying contains a microcontroller chip inside it.
- Microcontrollers come with a wide range of applications but it depends on you to decide what task you want to achieve with the help of microcontroller because it will only take instructions in the form of programming language.
- You can build, upload and execute any program depending on your priorities.
Comparison with Microprocessor
- Some people think microcontroller and microprocessor are same, but they are different actually.
- Microprocessor use external circuity in order to build communication with peripheral environment, but microcontroller doesn't involve any external circuitry to put it in a running condition as it comes with a specified built-in circuity that saves both space and cost to design a device of similar characteristics.
- As compared to microprocessor which are widely used in PCs, laptops and notepads, microcontrollers are specially made for embedded system.
- When we talk about embedded system, we actually refer to a devices that come with built in circuitry and need load of proper instructions to control the devices.
- Great thing about embedded system is that it involves customized programming that is directly connected to internal circuitry which can be modified again and again till you achieve your desired result.
- Clock speed of microprocessor is much larger than microcontroller and they are capable of doing complex tasks. They can operate at the frequency of 1 GHZ.
Comparison with Desktop Computers
- In contrast to our desktop computer, microcontrollers are tiny computers which contains memory much less than desktop computer.
- Also the speed of desktop computer is much larger than speed of the simple microcontroller.
- However, microcontrollers exhibit some features similar to desktop computers like it comes with central processing unit which is brain of the microcontroller.
- These CPU in microcontrollers come with different word length i.e from 4 bit to 64 bit.
- They can operate at lower frequencies at 4 kHZ and have an ability to retain functionality before reset button is pressed or some interrupt is called.
- In modern technologies, some microcontrollers devices constitute a complex design and are capable of having word length more than 64 bit.
- Microcontroller consists of built in components including EPROM, EEPROM, RAM, ROM, timers, I/O ports and reset button. RAM is used for data storage while ROM is used for program and other parameters storage.
- Modern microcontroller are designed using CISC (complex instruction set computer) architecture which involves marco-type instructions.
- Single macro type instruction is used to replace the number of small instructions.
- Modern microcontrollers operate at much lower power consumption as compared to older ones.
- They can operate at a lower voltage ranging from 1.8 V to 5.5 V.
- Flash memory like EPROM and EEPROM are very liable and advanced features in latest microcontrollers which set them apart from older microcontrollers.
- EPROM is faster and quick than EEPROM memory. It allows to erase and write cycles as many times as you want which makes it user friendly.
- Microcontroller is composed of several built in parts which makes it compact and productive in lesser space and cost. Following are the main parts of microcontroller.
- CPU is regarded as the brain of the microcontroller which takes instructions in the form of programming and helps to execute them.
- It behaves like a bridge that communicates with different components and activities happening inside the single chip.
- Customized programming option available in microcontroller makes it more reliable and user friendly.
- CPU is incorporated with on board registers which are divided into two types data registers and addressing registers.
- Data registers also known accumulators are used for logic and shifting instructions.
- Addressing registers are used for holding the addresses for memory data accessing. The stack pointer is referred as a address register which directs to the memory used for hardware stack. Hardware stack is used for interrupt calls and returns and for subroutine calls and returns.
- Hardware stack pointer design is not compulsory, some CPU comes with a single link register, which behaves like a deep stack on the CPU and helps in fast subroutine calls and returns.
- A microcontroller CPU is capable of executing series of instructions some of which are data manipulation instructions, some are logic instruction and some are shifting instructions.
- Different I/O ports are incorporated in the microcontroller.
- They are used to connect the external devices such as printers, LCD,LED, external memories to the microcontroller.
- There are several serial ports available in the microcontroller which are used to connect peripherals serially with the microcontroller.
- Similar to microprocessor, microcontroller comes with memory spaces such as RAM and ROM which help in storing the program source code.
- These memory spaces are very small as compared to desktop computers.
- Once you generate a program and upload in the microcontroller, it stores in the certain memory location of microcontroller.
- These memory locations are already set by the manufacturer.
Timers and Counters
- Timers and Counters are very handy in achieving different tasks including pulse generation, frequency generation, measuring, clock function and modulation.
- Timer and counters functions are synchronized with microcontroller clock, used for measuring time intervals between two events and can count up to 255 count for 8 bit microcontroller and 65535 for 16 bit microcontroller.
ADC and DAC
- ADC is an analog to digital converter which converts the analog signal to digital form such as converting analog signal of sensor into digital form.
- Similarly, DAC is a digital to analog converter which converts the digital signal into analog form which can be used to control motor.
- Interpret control is used to put a delay in the running program. This delay can be generated internally or externally.
Special Functioning Block
- Some advanced microcontrollers come with special functioning block that is used in latest robotics and advanced space systems.
- This special functioning block comes with more ports than normal microcontroller and is capable of doing most complex and advanced tasks.
Based on memory, architecture, and word size, microcontrollers are classified into various types. Some are as follow.
Classification based on Bits
- Microcontrollers come in 8 bit, 16 bit, 32 bit and 64 bit. Some most advanced microcontrollers have bits more than 64 which are capable of executing particular functions in the embedded systems.
- 8 bit microcontroller is capable of executing smaller arithmetic and logic instructions. Most common 8 bit microcontrollers are atmel 8031 and 8051.
- In contrast to 8 bit microcontroller, 16 bit microcontroller executes program with higher precision and accuracy. Most common 16 bit microcontroller is 8096.
- 32 bit microcontroller is applied into automatic control systems and robotics where high durability and reliability is required. Office machines and some power and communication systems use 32 bit controller to execute different instructions.
Classification based on Memory
- Based on memory, microcontrollers are divided into two types i.e.external memory microcontrollers and embedded memory microcontrollers.
- When embedded system needs both microcontroller and external functioning block that is not incorporated in microcontroller, then microcontroller is called external memory microcontroller. 8031 is a great example of external memory microcontroller.
- When all functioning blocks are incorporated in a single chip that is connected with embedded system, then microcontroller is called embedded memory microcontrollers. 8051 is a great example of embedded memory microcontrollers.
Classification based on Instruction Set
- Based on instruction set, microcontrollers are classified into two types i.e CISC-CISC and RISC-RISC.
- CISC is referred as complex instruction set computer. One valid instruction is enough to replace number of instructions.
- RISC is referred as reduced instruction set computer. RISC helps in reducing the operation time of executing the program. It does it by reducing the clock cycle per instruction.
Types of Microcontrollers
There are numerous types of microcontrollers and I am gonna discuss few of them in detail here:
- Most commonly used microcontrollers are belonged to 8051 family.
- 8051 microcontrollers are considered as an ideal choice for most of the professionals.
- Invented by Intel, 8051 microcontroller consists of two members including 8052 and 8031.
- 8052 consists of 3 times and 256 bytes RAM. It encompasses same features as that of 8051 microcontrollers.
- You can also consider 8051 as a subset of 8052 microcontroller..
- Similarly, 8031 exhibits same features as that of 8051 except ROM.
- However, external ROM of 64k bytes can be incorporated in this chip for execution of instructions.
8051 Microcontroller Architecture
- 8051 microcontroller is a 40 pin 8 bit microcontroller invented by Intel in 1981.
- 8051 comes with 128 bytes of RAM and 4KB of built in ROM.
- Based on priorities, 64 KB external memory can be incorporated with the microcontroller.
- A crystalline oscillator is embedded on this microcontroller which comes with a frequency of 12 MHz.
- Two 16 bit timers are integrated in this microcontroller that can be used as a timer as well as a counter.
- 8051 consists of 5 interrupts including External interrupt 0, external interrupt 1, Timer interrupt 0, timer interrupt 1 and Serial port interrupt. It also consists of four 8 bits programmable ports.
- Micro-chip technology invented Peripheral Interface Controller (PIC) which is very common among most of the professionals and experts.
- Micro-chip Technology is very concerned with the needs and requirements of the customers so they constantly keep upgrading their products in order to provide top notch service.
- Low cost, serial programmable ability, and wide availability make this microcontroller stand out of the party.
PIC Microcontroller Architechture
- PIC microcontroller supports Harvard architecture.
- It consists of ROM, CPU, serial communication, timers and counters, oscillators, interrupts, I/O ports and set of registers that also behave as a RAM.
- Special purpose registers are also incorporated on chip hardware.
- Low power consumption makes this controller an ideal choice for an industrial purpose.
- Every PIC brings into play "stack" that is capable of saving return addresses.
- In the older version of PIC microcontrollers, stack could not be accessed by programming, but later versions can be easily accessed by programming.
- Low specification computer is enough to run the software that is capable of programming the PIC microcontroller circuit.
- Serial port or USB port is used to connect he computer with the microcontroller.
- AVR is referred as Advances Virtual RISC which was produced by Atmel in 1966.
- It supports Harvard Architecture in which program and data is stored in different spaces of microcontroller and can easily be accessed.
- It is considered as earlier types of controllers in which on-chip flash is used for storing program.
- AVR architecture was produced by Vegard Wollan and Alf-Egil Bogen.
- The AT90S8515 was the first controller that was based on AVR architechture.
- However, AT90S1200 was the first AVR microcontroller that was commercially available in 1997.
- The flash, EEPROM and SRAM all are integrated on a single chip, which removes the possibility of joining any external memory with the controller.
- This controller has a watchdog timer and many power saving sleep modes that make this controller reliable and user-friendly.
- Peripheral controller of a PC
- Robotics and Embedded systems
- Bio-medical equipment
- Communication and power systems
- Automobiles and security systems
- Implanted medical equipment
- Fire detection devices
- Temperature and light sensing devices
- Industrial automation devices
- Process control devices
- Measuring and Controlling revolving objects
That's all for today. I hope you have enjoyed the article. Our job is to provide you useful information step by step, so you can digest the information without much effort. However, if still you feel skeptical or have any doubt you can ask me in the comment section below. I'd love to help you according to best of my expertise. Stay Tuned.