SlideShare a Scribd company logo
1 of 36
MICROCONTROLLER THE BRAIN
WHAT ARE MICROCONTROLLERS ? A micro-controller (also MCU or µC) is a functional computer system-on-a- chip. It contains a processor core, memory and programmable input/output  peripherals. Micro suggests that the device is small and controller tells you that the device  might be used to control objects, processes or events.  Another term to describe a microcontroller  is embedded controller because  the microcontroller  and its support circuits are often built into or embedded in the devices they control.
WHERE WE USE THEM…???
Basic block diagram of a microcontroller
CPU :  CPU does all the arithmetic and logic operations. It controls the flow of execution of instructions.
RAM ( Random Access Memory) : RAM holds the set of instructions (program), i.e. being executed by the CPU. It holds important data required by the program. It holds some important data structures like ‘stack’. It is volatile in nature.
ROM ( Read Only Memory) : ROM holds very important data and initialization about the microcontroller. It holds the monitor program. It is written by the manufacturer.
Flash Memory : Flash memory is basically EEPROM. It holds the program written by the user. The program can be erased or written here many times. ( Specified by the manufacturer)
I/0 Ports : Every microcontroller has I/O ports. Each port is made up of n-pins ( mostly 8 pins). Each pin can be configured as either input pin or output pin. If a pin is input pin, it accepts data from the device it is connected to. If a pin is output pin, it sends the data to the device it is connected to. Thus these pins form the input/output medium for the microcontrollers.
ADC : Most of the real world signals are analog in nature. But a microcontroller is a digital device, thus it cannot process analog signals. Thus all microcontrollers have built in A-D converters. ADC digitizes an analog signal and gives it to the microcontroller for further processing.
TIMERS : In many applications, time keeping is a must. Eg. If you heating a meal in an oven. Thus microcontrollers have timers to measure time.
SOME COMMON MICROCONTROLLERS  Intel - 8051  Atmel – Atmega 16   PIC  ARM
Question: How a microcontroller works ???  Answer: Microcontroller consists of a Microprocessor (CPU i.e. Central processing Unit) which is interfaced to RAM (Random Access Memory) and Flash Memory (EEPROM). You feed your program in the Flash Memory on the microcontroller. Now when you turn on the microcontroller, CPU accesses the instructions from RAM which access your code from Flash. It sets the configuration of the pins and then start performing according to your program.
Question: How to make the code ?  Answer: You basically write the program on your computer in any of the high level languages like C, C++, JAVA etc. Then you compile the code to generate the machine file.      All the machines understand only one language, 0 & 1 that is on and off. Now this 0 & 1 both corresponds to 2 different voltage levels for example 0 volt for 0 logic and +5 volt for 1 logic. Actually the code has to be written in this 0, 1 language and then saved in the memory of the microcontroller. But this will be very difficult task. So we write the code in the language we understand (eg. C) and then compile and make the machine file “.hex”. After we make this machine file we feed this to the memory of the microcontroller.
Question: How to feed the code in the flash of Microcontroller ?  Answer: Assuming you have the machine file (.hex) ready and now you want to feed that to the flash of the microcontroller. Basically you want to make communication between your computer and microcontroller. Now computer has many communication ports such as Serial Port, Parallel Port and USB (Universal Serial Bus).       Let’s take Serial Port, it has its own definition that is voltage level to define 0 & 1. Serial Port's protocol is called as UART (Universal Asynchronous Receiver & Transmitter). Its voltage levels are : +12 volt for 0 logic and -12 volt for 1 logic.       Now the voltage levels of our microcontroller are based on CMOS (Complementary Metal Oxide Semiconductor) technology which has 0 volt for 0 logic and +5 volt for 1 logic. Two different machines with 2 different ways to define 0 & 1 and we want to exchange information between them. Consider microcontroller as a French and Computer's Serial Port as an Indian person. If they want to exchange information they basically need a mediator who knows both the language. He will listen one person and then translate to other person. Similarly we need a circuit which converts CMOS (microcontroller) to UART (serial port) and vice versa. This circuit is called as programmer. Using this circuit we can connect computer to the microcontroller and feed the machine file to the flash.
ATMEGA 16 MICROCONTROLLER Manufacturer :  ATMEL CORPORATION,         	            USA. http://www.atmel.com/
ATMEGA 16 SPECIFICATIONS :  Advanced RISC Architecture  131 Powerful Instructions – Most Single-clock Cycle Execution 32 x 8 General Purpose Working Registers  Up to 16 MIPS Throughput at 16 MHz   16K Bytes of In-System Self-Programmable Flash   512 Bytes EEPROM   1K Byte Internal SRAM   32 Programmable I/O Lines   In-System Programming by On-chip Boot Program   8-channel, 10-bit ADC   Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes   One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture   Four PWM Channels   Programmable Serial USART   Master/Slave SPI Serial Interface   Byte-oriented Two-wire Serial Interface   Programmable Watchdog Timer with Separate On-chip Oscillator   External and Internal Interrupt Sources
PIN CONFIGURATION :
Registers All the configurations in a microcontroller is set through 8 bit (1 byte) locations in RAM (RAM is a bank of memory bytes) of the microcontroller called as Registers.  All the functions are mapped to its locations in RAM and the value we set at that location that is at that Register configures the functioning of microcontroller.  There are total 32 x 8bit registers in Atmega-16. As Register size of this microcontroller is 8 bit, it called as 8 bit microcontroller.
For example :
Digital Input Output Port So let’s start with understanding the functioning of AVR. We will first discuss about I/O Ports. Atmega 16 has 32 I/O (Input/Output) pins grouped as A, B, C & D with 8 pins in each group. This group is called as PORT.   PA0 - PA7 (PORTA)   PB0 - PB7 (PORTB)   PC0 - PC7 (PORTC)   PD0 - PD7 (PORTD)
Data Direction Register, DDRn Determines the direction of individual pins of ports.  If the bit of the DDR is set (1) the corresponding pin of the port is configured as output pin  If the bit of the DDR is cleared (0) the     corresponding pin of the port is configured as     input pin. DDRA = 0xF0;  4 MSB pins of PORTA are output pins  4 LSB pins of PORTA are input pins
Port Pin Register, PINn Reading the input pins of port is done by reading PIN register Temp = PINA; Read the PORTA input and store in temp variable
Port Drive Register, PORTn If the pin is configured as output (DDRn [x] = 1) PORTn register drives the corresponding value on the output pins DDRA = 0xFF; PORTA = 0xF0; Output logic high on 4 MSB pins and logic low on 4 LSB pins
Port Drive Register, PORTn For pins configured as input (DDRn[x] = 0) microcontroller connects a internal pull up resistor if the corresponding bit of PORTn is set  If the PORTn bit is cleared, pin is Tristated  DDRA = 0x00;  PORTA = 0xF0;
Buzzer On / OFF Buzzer is connected to pin 7 of PORT B. Pin is configured as output DDRB= 0x80; To turn on the buzzer output high PORTB = 0x80; To turn off the buzzer output low PORTB = 0x00;
Buzzer Function void Buzzer_ON(void) {   PORTB = 0x80; } void Buzzer_OFF(void) {   PORTB = PORTB & 0x7F; }
Bump Switch  PORTC (0)  Input port DDRC= 0x00;  Internal pull up PORTC = 0x01;  To read inputs portc_copy = PINC
void main(void) { init_devices();    //insert your functional code here...    while(1)                                   //open continuous loop (while)    { portc_copy = PINC;        //read contents of port C into the portc_copy variable      if(portc_copy == 0x01)  //check if any switch is pressed by comparing bitwise with               	                                  //0x01 ('==' comparison)     {        PORTB = 0x00;      //if condition is true turn OFF buzzer by giving PORTB = 0x00     }     else                                      //if condition is false turn ON buzzer to     {                                            //indicate bump switch is pressed by giving PORTB = 0x80        PORTB = 0x80;      }   } }
WALL HUG USING BUMP SWITCHES: PC2 PC3 PC1 PC4 PC0
This is PORTB Pin 0 is connected to LED0. Pin 1 is connected to LED1. Pin 2 is connected to LED2. Pin 3 is connected to LED3. Pin 4 is connected to LED4.
ADC Analog To Digital Converter
Analog To Digital Converter  10 bit resolution  8 channels  PORTA(0 – 7) – (ADC1-ADC7)  Disable internal pull up  ADCH & ADCL – Data Register  ADMUX- Channel Select Register  ADCSR – Control & Status Register
Theory of operation  What we have seen till now that the input given to uC was digital, i.e., either +5 V (logic 1) or 0V (logic 0). But what if we have an analog input. Then we require a tool that converts this analog voltage to discrete values. Analog to Digital Converter (ADC) is such a tool.
Microcontroller

More Related Content

What's hot

Embedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerEmbedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerGaurav Verma
 
8051 Microcontroller ppt
8051 Microcontroller ppt8051 Microcontroller ppt
8051 Microcontroller pptRahul Kumar
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontrollerthokalpv
 
Classification of embedded systems
Classification of embedded systemsClassification of embedded systems
Classification of embedded systemsVikas Dongre
 
MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration AKHIL MADANKAR
 
Introduction to embedded systems
Introduction  to embedded systemsIntroduction  to embedded systems
Introduction to embedded systemsRAMPRAKASHT1
 
Microprocessor 8085 complete
Microprocessor 8085 completeMicroprocessor 8085 complete
Microprocessor 8085 completeShubham Singh
 
Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)Moe Moe Myint
 

What's hot (20)

Embedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerEmbedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontroller
 
8051 Microcontroller ppt
8051 Microcontroller ppt8051 Microcontroller ppt
8051 Microcontroller ppt
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counter
 
Classification of embedded systems
Classification of embedded systemsClassification of embedded systems
Classification of embedded systems
 
MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration
 
8051 memory
8051 memory8051 memory
8051 memory
 
Microcontroller 8096
Microcontroller 8096Microcontroller 8096
Microcontroller 8096
 
I o ports.ppt
I o ports.pptI o ports.ppt
I o ports.ppt
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
 
Embedded systems
Embedded systemsEmbedded systems
Embedded systems
 
Embedded systems ppt
Embedded systems pptEmbedded systems ppt
Embedded systems ppt
 
Introduction to embedded systems
Introduction  to embedded systemsIntroduction  to embedded systems
Introduction to embedded systems
 
8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER
 
Microprocessor 8085 complete
Microprocessor 8085 completeMicroprocessor 8085 complete
Microprocessor 8085 complete
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)
 
Serial Communication in 8051
Serial Communication in 8051Serial Communication in 8051
Serial Communication in 8051
 
Timing diagram 8085 microprocessor
Timing diagram 8085 microprocessorTiming diagram 8085 microprocessor
Timing diagram 8085 microprocessor
 
Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 

Viewers also liked

Microcontroller presentation
Microcontroller presentationMicrocontroller presentation
Microcontroller presentationredwan1006066
 
Introduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and MicrocontrollersIntroduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and MicrocontrollersIslam Samir
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Rashmi
 
AVR Fundamentals
AVR FundamentalsAVR Fundamentals
AVR FundamentalsVinit Vyas
 
Introduction to AVR Microcontroller
Introduction to AVR Microcontroller Introduction to AVR Microcontroller
Introduction to AVR Microcontroller Mahmoud Sadat
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Ganesh Ram
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller NotesDr.YNM
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessorKashyap Shah
 
Human area networks(ad's)
Human area networks(ad's)Human area networks(ad's)
Human area networks(ad's)Ankur Doda
 
Fault identification in transformer winding
Fault identification in transformer windingFault identification in transformer winding
Fault identification in transformer windingeSAT Journals
 
7 segment interface with avr microcontroller
7 segment interface with avr microcontroller7 segment interface with avr microcontroller
7 segment interface with avr microcontrollerKushagra Ganeriwal
 
ARDUINO EMBEDDED SYSTEM
ARDUINO EMBEDDED SYSTEMARDUINO EMBEDDED SYSTEM
ARDUINO EMBEDDED SYSTEMVishal GARG
 
Projects based on atmega controlleer
Projects based on atmega  controlleerProjects based on atmega  controlleer
Projects based on atmega controlleersumit tiwari
 
Microprocessors
MicroprocessorsMicroprocessors
MicroprocessorsSpitiq
 
A.F. Ismail (presentation)
A.F. Ismail (presentation)A.F. Ismail (presentation)
A.F. Ismail (presentation)Elektro_UMBO
 
Basic electronics.rtf
Basic electronics.rtfBasic electronics.rtf
Basic electronics.rtfsagarpiet16
 
2013 IEEE eee hard ware projects
2013 IEEE eee hard ware projects2013 IEEE eee hard ware projects
2013 IEEE eee hard ware projectsVision Solutions
 

Viewers also liked (20)

Microcontroller presentation
Microcontroller presentationMicrocontroller presentation
Microcontroller presentation
 
Introduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and MicrocontrollersIntroduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and Microcontrollers
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
AVR Fundamentals
AVR FundamentalsAVR Fundamentals
AVR Fundamentals
 
Introduction to AVR Microcontroller
Introduction to AVR Microcontroller Introduction to AVR Microcontroller
Introduction to AVR Microcontroller
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessor
 
Presentation1 (1)
Presentation1 (1)Presentation1 (1)
Presentation1 (1)
 
Human area networks(ad's)
Human area networks(ad's)Human area networks(ad's)
Human area networks(ad's)
 
Fault identification in transformer winding
Fault identification in transformer windingFault identification in transformer winding
Fault identification in transformer winding
 
Basics of ATmega32
Basics of ATmega32Basics of ATmega32
Basics of ATmega32
 
7 segment interface with avr microcontroller
7 segment interface with avr microcontroller7 segment interface with avr microcontroller
7 segment interface with avr microcontroller
 
ARDUINO EMBEDDED SYSTEM
ARDUINO EMBEDDED SYSTEMARDUINO EMBEDDED SYSTEM
ARDUINO EMBEDDED SYSTEM
 
Projects based on atmega controlleer
Projects based on atmega  controlleerProjects based on atmega  controlleer
Projects based on atmega controlleer
 
Microprocessors
MicroprocessorsMicroprocessors
Microprocessors
 
Lcd & keypad
Lcd & keypadLcd & keypad
Lcd & keypad
 
A.F. Ismail (presentation)
A.F. Ismail (presentation)A.F. Ismail (presentation)
A.F. Ismail (presentation)
 
Basic electronics.rtf
Basic electronics.rtfBasic electronics.rtf
Basic electronics.rtf
 
2013 IEEE eee hard ware projects
2013 IEEE eee hard ware projects2013 IEEE eee hard ware projects
2013 IEEE eee hard ware projects
 

Similar to Microcontroller

Hardware interfacing basics using AVR
Hardware interfacing basics using AVRHardware interfacing basics using AVR
Hardware interfacing basics using AVRMohamed Abdallah
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Sadiq Rahim
 
embedded system and microcontroller
 embedded system and microcontroller embedded system and microcontroller
embedded system and microcontrollerSHILPA Sillobhargav
 
Chp4 introduction to the pic microcontroller copy
Chp4 introduction to the pic microcontroller   copyChp4 introduction to the pic microcontroller   copy
Chp4 introduction to the pic microcontroller copymkazree
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerRup Chowdhury
 
Introduction2_PIC.ppt
Introduction2_PIC.pptIntroduction2_PIC.ppt
Introduction2_PIC.pptAakashRawat35
 
janakiraman egsp collage I msc 4 unit
janakiraman egsp collage  I msc 4 unitjanakiraman egsp collage  I msc 4 unit
janakiraman egsp collage I msc 4 unitjanakiramang6
 
microcontroller basics
microcontroller basicsmicrocontroller basics
microcontroller basicssagar Ramdev
 
janakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiramang6
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarGauravRaikar3
 
PIC introduction + mapping
PIC introduction + mappingPIC introduction + mapping
PIC introduction + mappingOsaMa Hasan
 

Similar to Microcontroller (20)

Avr microcontroller
Avr microcontrollerAvr microcontroller
Avr microcontroller
 
Presentation
PresentationPresentation
Presentation
 
Hardware interfacing basics using AVR
Hardware interfacing basics using AVRHardware interfacing basics using AVR
Hardware interfacing basics using AVR
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Microcontroller 8051 gs
Microcontroller 8051 gsMicrocontroller 8051 gs
Microcontroller 8051 gs
 
embedded system and microcontroller
 embedded system and microcontroller embedded system and microcontroller
embedded system and microcontroller
 
Chp4 introduction to the pic microcontroller copy
Chp4 introduction to the pic microcontroller   copyChp4 introduction to the pic microcontroller   copy
Chp4 introduction to the pic microcontroller copy
 
unit-2.pptx
unit-2.pptxunit-2.pptx
unit-2.pptx
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontroller
 
Picmico
PicmicoPicmico
Picmico
 
Introduction2_PIC.ppt
Introduction2_PIC.pptIntroduction2_PIC.ppt
Introduction2_PIC.ppt
 
janakiraman egsp collage I msc 4 unit
janakiraman egsp collage  I msc 4 unitjanakiraman egsp collage  I msc 4 unit
janakiraman egsp collage I msc 4 unit
 
microcontroller basics
microcontroller basicsmicrocontroller basics
microcontroller basics
 
Assignment
AssignmentAssignment
Assignment
 
janakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiraman I msc 4 unit
janakiraman I msc 4 unit
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikar
 
digital clock atmega16
digital clock atmega16digital clock atmega16
digital clock atmega16
 
PIC introduction + mapping
PIC introduction + mappingPIC introduction + mapping
PIC introduction + mapping
 
8051 Presentation
8051 Presentation8051 Presentation
8051 Presentation
 
Iot Workshop NITT 2015
Iot Workshop NITT 2015Iot Workshop NITT 2015
Iot Workshop NITT 2015
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Microcontroller

  • 2. WHAT ARE MICROCONTROLLERS ? A micro-controller (also MCU or µC) is a functional computer system-on-a- chip. It contains a processor core, memory and programmable input/output peripherals. Micro suggests that the device is small and controller tells you that the device might be used to control objects, processes or events. Another term to describe a microcontroller is embedded controller because the microcontroller and its support circuits are often built into or embedded in the devices they control.
  • 3. WHERE WE USE THEM…???
  • 4. Basic block diagram of a microcontroller
  • 5. CPU : CPU does all the arithmetic and logic operations. It controls the flow of execution of instructions.
  • 6. RAM ( Random Access Memory) : RAM holds the set of instructions (program), i.e. being executed by the CPU. It holds important data required by the program. It holds some important data structures like ‘stack’. It is volatile in nature.
  • 7. ROM ( Read Only Memory) : ROM holds very important data and initialization about the microcontroller. It holds the monitor program. It is written by the manufacturer.
  • 8. Flash Memory : Flash memory is basically EEPROM. It holds the program written by the user. The program can be erased or written here many times. ( Specified by the manufacturer)
  • 9. I/0 Ports : Every microcontroller has I/O ports. Each port is made up of n-pins ( mostly 8 pins). Each pin can be configured as either input pin or output pin. If a pin is input pin, it accepts data from the device it is connected to. If a pin is output pin, it sends the data to the device it is connected to. Thus these pins form the input/output medium for the microcontrollers.
  • 10. ADC : Most of the real world signals are analog in nature. But a microcontroller is a digital device, thus it cannot process analog signals. Thus all microcontrollers have built in A-D converters. ADC digitizes an analog signal and gives it to the microcontroller for further processing.
  • 11. TIMERS : In many applications, time keeping is a must. Eg. If you heating a meal in an oven. Thus microcontrollers have timers to measure time.
  • 12. SOME COMMON MICROCONTROLLERS Intel - 8051 Atmel – Atmega 16 PIC ARM
  • 13. Question: How a microcontroller works ??? Answer: Microcontroller consists of a Microprocessor (CPU i.e. Central processing Unit) which is interfaced to RAM (Random Access Memory) and Flash Memory (EEPROM). You feed your program in the Flash Memory on the microcontroller. Now when you turn on the microcontroller, CPU accesses the instructions from RAM which access your code from Flash. It sets the configuration of the pins and then start performing according to your program.
  • 14. Question: How to make the code ? Answer: You basically write the program on your computer in any of the high level languages like C, C++, JAVA etc. Then you compile the code to generate the machine file. All the machines understand only one language, 0 & 1 that is on and off. Now this 0 & 1 both corresponds to 2 different voltage levels for example 0 volt for 0 logic and +5 volt for 1 logic. Actually the code has to be written in this 0, 1 language and then saved in the memory of the microcontroller. But this will be very difficult task. So we write the code in the language we understand (eg. C) and then compile and make the machine file “.hex”. After we make this machine file we feed this to the memory of the microcontroller.
  • 15. Question: How to feed the code in the flash of Microcontroller ? Answer: Assuming you have the machine file (.hex) ready and now you want to feed that to the flash of the microcontroller. Basically you want to make communication between your computer and microcontroller. Now computer has many communication ports such as Serial Port, Parallel Port and USB (Universal Serial Bus). Let’s take Serial Port, it has its own definition that is voltage level to define 0 & 1. Serial Port's protocol is called as UART (Universal Asynchronous Receiver & Transmitter). Its voltage levels are : +12 volt for 0 logic and -12 volt for 1 logic. Now the voltage levels of our microcontroller are based on CMOS (Complementary Metal Oxide Semiconductor) technology which has 0 volt for 0 logic and +5 volt for 1 logic. Two different machines with 2 different ways to define 0 & 1 and we want to exchange information between them. Consider microcontroller as a French and Computer's Serial Port as an Indian person. If they want to exchange information they basically need a mediator who knows both the language. He will listen one person and then translate to other person. Similarly we need a circuit which converts CMOS (microcontroller) to UART (serial port) and vice versa. This circuit is called as programmer. Using this circuit we can connect computer to the microcontroller and feed the machine file to the flash.
  • 16. ATMEGA 16 MICROCONTROLLER Manufacturer : ATMEL CORPORATION, USA. http://www.atmel.com/
  • 17. ATMEGA 16 SPECIFICATIONS : Advanced RISC Architecture 131 Powerful Instructions – Most Single-clock Cycle Execution 32 x 8 General Purpose Working Registers Up to 16 MIPS Throughput at 16 MHz 16K Bytes of In-System Self-Programmable Flash 512 Bytes EEPROM 1K Byte Internal SRAM 32 Programmable I/O Lines In-System Programming by On-chip Boot Program 8-channel, 10-bit ADC Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Four PWM Channels Programmable Serial USART Master/Slave SPI Serial Interface Byte-oriented Two-wire Serial Interface Programmable Watchdog Timer with Separate On-chip Oscillator External and Internal Interrupt Sources
  • 19.
  • 20. Registers All the configurations in a microcontroller is set through 8 bit (1 byte) locations in RAM (RAM is a bank of memory bytes) of the microcontroller called as Registers. All the functions are mapped to its locations in RAM and the value we set at that location that is at that Register configures the functioning of microcontroller. There are total 32 x 8bit registers in Atmega-16. As Register size of this microcontroller is 8 bit, it called as 8 bit microcontroller.
  • 22. Digital Input Output Port So let’s start with understanding the functioning of AVR. We will first discuss about I/O Ports. Atmega 16 has 32 I/O (Input/Output) pins grouped as A, B, C & D with 8 pins in each group. This group is called as PORT. PA0 - PA7 (PORTA) PB0 - PB7 (PORTB) PC0 - PC7 (PORTC) PD0 - PD7 (PORTD)
  • 23. Data Direction Register, DDRn Determines the direction of individual pins of ports. If the bit of the DDR is set (1) the corresponding pin of the port is configured as output pin If the bit of the DDR is cleared (0) the corresponding pin of the port is configured as input pin. DDRA = 0xF0; 4 MSB pins of PORTA are output pins 4 LSB pins of PORTA are input pins
  • 24. Port Pin Register, PINn Reading the input pins of port is done by reading PIN register Temp = PINA; Read the PORTA input and store in temp variable
  • 25. Port Drive Register, PORTn If the pin is configured as output (DDRn [x] = 1) PORTn register drives the corresponding value on the output pins DDRA = 0xFF; PORTA = 0xF0; Output logic high on 4 MSB pins and logic low on 4 LSB pins
  • 26. Port Drive Register, PORTn For pins configured as input (DDRn[x] = 0) microcontroller connects a internal pull up resistor if the corresponding bit of PORTn is set If the PORTn bit is cleared, pin is Tristated DDRA = 0x00; PORTA = 0xF0;
  • 27. Buzzer On / OFF Buzzer is connected to pin 7 of PORT B. Pin is configured as output DDRB= 0x80; To turn on the buzzer output high PORTB = 0x80; To turn off the buzzer output low PORTB = 0x00;
  • 28. Buzzer Function void Buzzer_ON(void) { PORTB = 0x80; } void Buzzer_OFF(void) { PORTB = PORTB & 0x7F; }
  • 29. Bump Switch PORTC (0) Input port DDRC= 0x00; Internal pull up PORTC = 0x01; To read inputs portc_copy = PINC
  • 30. void main(void) { init_devices(); //insert your functional code here... while(1) //open continuous loop (while) { portc_copy = PINC; //read contents of port C into the portc_copy variable if(portc_copy == 0x01) //check if any switch is pressed by comparing bitwise with //0x01 ('==' comparison) { PORTB = 0x00; //if condition is true turn OFF buzzer by giving PORTB = 0x00 } else //if condition is false turn ON buzzer to { //indicate bump switch is pressed by giving PORTB = 0x80 PORTB = 0x80; } } }
  • 31. WALL HUG USING BUMP SWITCHES: PC2 PC3 PC1 PC4 PC0
  • 32. This is PORTB Pin 0 is connected to LED0. Pin 1 is connected to LED1. Pin 2 is connected to LED2. Pin 3 is connected to LED3. Pin 4 is connected to LED4.
  • 33. ADC Analog To Digital Converter
  • 34. Analog To Digital Converter 10 bit resolution 8 channels PORTA(0 – 7) – (ADC1-ADC7) Disable internal pull up ADCH & ADCL – Data Register ADMUX- Channel Select Register ADCSR – Control & Status Register
  • 35. Theory of operation What we have seen till now that the input given to uC was digital, i.e., either +5 V (logic 1) or 0V (logic 0). But what if we have an analog input. Then we require a tool that converts this analog voltage to discrete values. Analog to Digital Converter (ADC) is such a tool.