SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere Àhnliche Inhalte

Was ist angesagt?

AVRTIMER.pptx
AVRTIMER.pptxAVRTIMER.pptx
AVRTIMER.pptxPratik Gohel
 
L15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 pL15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 prsamurti
 
LPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERLPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERsravannunna24
 
Introduction to embedded systems
Introduction  to embedded systemsIntroduction  to embedded systems
Introduction to embedded systemsRAMPRAKASHT1
 
microcontroller basics
microcontroller basicsmicrocontroller basics
microcontroller basicssagar Ramdev
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller NotesDr.YNM
 
Pic microcontroller architecture
Pic microcontroller architecturePic microcontroller architecture
Pic microcontroller architectureDominicHendry
 
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONSRamaPrabha24
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Aarav Soni
 
AVR Microcontroller
AVR MicrocontrollerAVR Microcontroller
AVR MicrocontrollerÖzcan Acar
 
Introduction to arduino ppt main
Introduction to  arduino ppt mainIntroduction to  arduino ppt main
Introduction to arduino ppt maineddy royappa
 
Introduction to Avr Microcontrollers
Introduction to Avr MicrocontrollersIntroduction to Avr Microcontrollers
Introduction to Avr MicrocontrollersMohamed Tarek
 
microcontroller vs microprocessor
microcontroller vs microprocessormicrocontroller vs microprocessor
microcontroller vs microprocessorsobhadevi
 
Introducion to MSP430 Microcontroller.pptx
Introducion to MSP430 Microcontroller.pptxIntroducion to MSP430 Microcontroller.pptx
Introducion to MSP430 Microcontroller.pptxDr.YNM
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESDr.YNM
 
I/O port programming in 8051
I/O port programming in 8051I/O port programming in 8051
I/O port programming in 8051ssuser3a47cb
 

Was ist angesagt? (20)

AVRTIMER.pptx
AVRTIMER.pptxAVRTIMER.pptx
AVRTIMER.pptx
 
AVR ATmega32
AVR ATmega32AVR ATmega32
AVR ATmega32
 
L15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 pL15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 p
 
LPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLERLPC 2148 ARM MICROCONTROLLER
LPC 2148 ARM MICROCONTROLLER
 
Introduction to embedded systems
Introduction  to embedded systemsIntroduction  to embedded systems
Introduction to embedded systems
 
microcontroller basics
microcontroller basicsmicrocontroller basics
microcontroller basics
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
 
Pic microcontroller architecture
Pic microcontroller architecturePic microcontroller architecture
Pic microcontroller architecture
 
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
 
AVR Microcontroller
AVR MicrocontrollerAVR Microcontroller
AVR Microcontroller
 
Introduction to arduino ppt main
Introduction to  arduino ppt mainIntroduction to  arduino ppt main
Introduction to arduino ppt main
 
Communication protocols - Embedded Systems
Communication protocols - Embedded SystemsCommunication protocols - Embedded Systems
Communication protocols - Embedded Systems
 
Introduction to Avr Microcontrollers
Introduction to Avr MicrocontrollersIntroduction to Avr Microcontrollers
Introduction to Avr Microcontrollers
 
microcontroller vs microprocessor
microcontroller vs microprocessormicrocontroller vs microprocessor
microcontroller vs microprocessor
 
ARM Processor
ARM ProcessorARM Processor
ARM Processor
 
8051 Presentation
8051 Presentation8051 Presentation
8051 Presentation
 
Introducion to MSP430 Microcontroller.pptx
Introducion to MSP430 Microcontroller.pptxIntroducion to MSP430 Microcontroller.pptx
Introducion to MSP430 Microcontroller.pptx
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTES
 
I/O port programming in 8051
I/O port programming in 8051I/O port programming in 8051
I/O port programming in 8051
 

Andere mochten auch

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
 
8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER THANDAIAH PRABU
 
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
 
T.H. (presentation)
T.H. (presentation)T.H. (presentation)
T.H. (presentation)ElektroUMBO
 

Andere mochten auch (20)

Microcontroller presentation
Microcontroller presentationMicrocontroller presentation
Microcontroller presentation
 
Introduction in microcontroller
Introduction in microcontrollerIntroduction in microcontroller
Introduction in microcontroller
 
Introduction to Microcontroller
Introduction to MicrocontrollerIntroduction to Microcontroller
Introduction to Microcontroller
 
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
 
8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER
 
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
 
T.H. (presentation)
T.H. (presentation)T.H. (presentation)
T.H. (presentation)
 

Ähnlich wie Microcontroller

Presentation
PresentationPresentation
PresentationAbhijit Das
 
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
 
Microcontroller 8051 gs
Microcontroller 8051 gsMicrocontroller 8051 gs
Microcontroller 8051 gsMoorthy Peesapati
 
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
 
Picmico
PicmicoPicmico
Picmicologes91
 
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
 
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
 
digital clock atmega16
digital clock atmega16digital clock atmega16
digital clock atmega16Arcanjo Salazaku
 
PIC introduction + mapping
PIC introduction + mappingPIC introduction + mapping
PIC introduction + mappingOsaMa Hasan
 
Iot Workshop NITT 2015
Iot Workshop NITT 2015Iot Workshop NITT 2015
Iot Workshop NITT 2015Srivignessh Pss
 
Embedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower BotEmbedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower BotEr. Raju Bhardwaj
 
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentsEMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentseceprinter6
 

Ähnlich wie 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
 
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
 
Iot Workshop NITT 2015
Iot Workshop NITT 2015Iot Workshop NITT 2015
Iot Workshop NITT 2015
 
Embedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower BotEmbedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower Bot
 
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentsEMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
 

KĂŒrzlich hochgeladen

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...gurkirankumar98700
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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
 

KĂŒrzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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...
 

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.