SlideShare a Scribd company logo
1 of 23
TRAINING REPORT
On
AVR MICROCONTROLLER
DEPTT. OF MECHATRONICS ENGINEERING
NITISH KUMAR
AVR MICROCONTROLLER
The ATmega8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC
architecture. By executing powerful instructionsin a single clock cycle, the
ATmega8 achieves through puts approaching1 MIPS per MHz, allowingthe system
designer to optimize power consumptionversus processing speed.
The AVR core combines a rich instruction set with 32 general purpose working
registers. All the32 registers are directly connected to the Arithmetic Logic Unit
(ALU), allowing two independentregisters to be accessed in one single instruction
executed in one clock cycle. The resulting architecture is more code efficient while
achievingthroughputs up to ten times faster than conventional CISC
microcontrollers.
The ATmega8 provides the following features: 8K bytes of In-System
Programmable Flash with Read-While-Write capabilities,512 bytes of EEPROM, 1K
byte of SRAM, 23 general purpose I/O lines, 32 general purpose working registers,
three flexible Timer/Counterswith compare modes, internal and external
interrupts, a serial programmable USART, a byte oriented Two wire Serial
Interface, a 6-channel ADC (eight channelsin TQFP and QFN/MLF packages) with
10-bit accuracy, a programmable Watchdog Timer with Internal Oscillator,an SPI
serial port, and five software selectable power saving modes. The Idle mode stops
the CPU while allowingthe SRAM, Timer/Counters, SPI port, and interrupt system
to continue functioning.The Power down mode saves the register contents but
freezes the Oscillator, disablingall other chip functions untilthe next Interrupt or
Hardware Reset. In Power-save mode, the asynchronoustimer continues to run,
allowingthe user to maintaina timer base while the rest of the device is sleeping.
The ADC Noise Reduction mode stops the CPU and all I/O modules except
asynchronous timer and ADC, to minimize switching noise during ADC
conversions. In Standbymode, the crystal/resonator Oscillatoris runningwhile the
rest of the device is sleeping. Thisallows very fast start-up combined with low-
power consumption.
The device is manufactured using Atmel’s high density non-volatilememory
technology. The Flash Program memory can be reprogrammed In-System through
an SPI serial interface, by a conventional non-volatilememory programmer, or by
an On-chip boot program running on the AVR core. The boot program can use any
interface to downloadthe applicationprogram in the ApplicationFlash memory.
Software in the Boot Flash Section will continue to run while the Application Flash
Section is updated,providing true Read-While-Write operation. By combiningan
8-bit RISC CPU with In-System Self-Programmable Flash on a monolithicchip, the
Atmel ATmega8 is a powerful microcontroller that provides a highly-flexibleand
cost-effective solution to many embedded control applications.
The ATmega8 AVR is supported with a full suite of program and system
developmenttools, IncludingC compilers, macro assemblers, program
debugger/simulators, In-Circuit Emulators, and evaluation kits.
features
High-performance, Low-power AVR® 8-bit Microcontroller
• Advanced RISC Architecture
– 130 Powerful Instructions – Most Single-clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
• High Endurance Non-volatile Memory segments
– 8K Bytes of In-System Self-programmableFlash program memory
– 512 Bytes EEPROM
– 1K Byte Internal SRAM
– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
– Data retention: 20 years at 85°C/100 years at 25°C(1)
– Optional Boot Code Section with Independent Lock Bits In-System
Programmingby On-chip Boot Program True Read-While-Write Operation
– ProgrammingLock for Software Security
• Peripheral Features
– Two 8-bit Timer/Counterswith Separate Prescaler, one Compare Mode
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and
Capture
Mode
– Real Time Counter with Separate Oscillator
– Three PWM Channels
– 8-channel ADC in TQFP and QFN/MLF package
Eight Channels 10-bit Accuracy
– 6-channel ADC in PDIP package
Six Channels 10-bit Accuracy
– Byte-oriented Two-wire Serial Interface
– Programmable Serial USART
– Master/Slave SPI Serial Interface
– Programmable Watchdog Timer with Separate On-chip Oscillator
– On-chip Analog Comparator
• Special Microcontroller Features
– Power-on Reset and ProgrammableBrown-out Detection
– Internal Calibrated RC Oscillator
– External and Internal Interrupt Sources
– Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, and
Standby
• I/O and Packages
– 23 ProgrammableI/O Lines
– 28-lead PDIP, 32-lead TQFP, and 32-pad QFN/MLF
• Operating Voltages
– 2.7 - 5.5V (ATmega8L)
– 4.5 - 5.5V (ATmega8)
• Speed Grades
– 0 - 8 MHz (ATmega8L)
– 0 - 16 MHz (ATmega8)
• Power Consumption at 4 Mhz, 3V, 25°C
– Active: 3.6 mA
– Idle Mode: 1.0 mA
– Power-down Mode: 0.5 Μa
PIN CONFIGURATION
USES OF DIFFERENT PINS OF ATMEGA8
One of the most important features of ATmega8 microcontroller is that
except 5 pins, all other pins can be used for supporting two signals.
o Pins 9,10,14,15,16,17,18,19 are used for port B, Whereas Pins
23,24,25,26,27,28 and 1 are used for port C and Pins 2,3,4,5,6,11,12 are used
for port D.
o Pin 1 is used as Reset pin and on applyinglow level signal for time longer than
minimum pulse length will generate a reset signal.
o Pins 3 and 2 can also be used in serial communication for USART (Universal
Synchronous and Asynchronous Receiver Transmitter).
o Pin 5 and 4 are used as external interrupts.
o Pins 10 and9 are used as timer counteroscillatorsas well as external oscillator
where the crystal is connected directly between the pins.
o Pin 19 is used as slave clock input or master clock output for Serial Peripheral
Interface (SPI) channel.
o Pin 18 is used as slave clock output or master clock input
o Pins 23 to 28 are used for analog to digital conversion (ADC) channels.
o Pin 12 and 13 are used as Analog Comparator inputs.
o Pins 6 and 11 are used as counter/timer sources.
TOOLS
• Compiler : WinAVR/AVR Studio/CodeVision AVR
• The programmer hardware
- Simple parallel/serialport based In System Programmer (ISP) or
- USB based ISP (recommended) : USBasp
• Bread board, wires, power supply, crystal, etc
POINTSTOBENOTED
• PORT : group of 8 pins, or set of pinsused for exchanging data with external
world
• Width of almost all registers : 8 bits (some 16 bits)
• In port related registers, every bit corresponds to one pin of the port.
Bit 0 corresponds to Pin 0
Bit 0 corresponds to Pin 1 .. Etc
• Remember direct one to one correspondence between HEX and BINARY
numbers.
0xFF = 1111 1111 0xAA =
1010 1010 0x11 = 0001
0001
INPUT/OUTPUTBASICS
ATmega8 microcontroller consists of 3 I/O ports, named as B, C and
D with a combination of 23 I/O lines. Port D consists of 8 I/O lines,
Port C consists of 7 I/O lines, and Port B consists of 8 I/O lines.
Registers corresponding to the Input/output port X (B, C or D) are:
o DDRX: Data Direction Register of Port X (for configuring Data Direction
(input/output) of the port pins.)
o PORTX: Dataregister of Port X (for writing the values to the port pinsinoutput
mode. Configuring the port pins in input mode.)
o PINX: Input register of Port X (reading data from port pins in input mode)
o Where x : A,B,C,D… depending on the available ports in your AVR.
DDR-DATADIRECTIONREGISTER
• Configures data direction of the port - Input / Output
• DDRx.n = 0 > makes corresponding port pin as input DDRx.n = 1 >
makes corresponding port pin as output
• Examples :
• to make all pins of port A as input pins:
DDRA = 0b00000000;
• to make all pins of port A as output pins
DDRA = 0b11111111;
• to make lower nibbleof port B as output and higher nibbleas
input
DDRB = 0b00001111;
PINREGISTER
• Used to read data from port pins, when port is configured as input.
• First set DDRx to zero, then use PINx to read the value.
• If PINx is read, when port is configured as output, it will give you data
that has been outputted on port.
• There two input modes :
- Tristated input
- Pullup input
This will be explainedshortly
• Example :
DDRA = 0x00; //Set PA as input x =
PINA; //Read contents of PA
PORTREGISTER
• Used for two purposes …
1) for data output, when port is configured as output:
• Writing to PORTx.n will immediately(in same clock cycle) change state
of the port pinsaccording to given value.
• Do not forget to load DDRx with appropriatevalue for configuring port
pins as output.
• Examples :
• to output 0xFF data on PB
DDRB = 0b11111111;
port b as outputs
//set all pins of
PORTB = 0xFF; //write data on port
• to output data in variablex on PA
DDRA = 0xFF; //make port a as output PORTA =
x; //output 8 bit variable on port
2) for configuring pin as tristate/pullup, when port is configured as
input) :
• When port is configures as input (i.e DDRx.n=1), then PORTx.n
controls the internalpull-up resistor.
• PORTx.n = 1 : Enables pullupfor nth bit
PORTx.n = 0 : Disables pullupfor nth bit, thus making it tristate
• Examples :
• to make PA as input with pull-upsenabled and read data from PA
DDRA = 0x00; //make port a as input
PORTA = 0xFF; //enable all pull-ups
y = PINA; //read data from port a pins
• to make PB as tri stated input
DDRB = 0x00; //make port b as input
PORTB = 0x00; //disable pull-ups and make it
tri state
What is pull-up ?
• Pull-up resistor is used to ensure that tri-stated input alwaysreads
HIGH (1) when it is not driven by any external entity.
• Pull-up is very important when you are using tri-stated input
buffers.
• Tri-state input pin offers very high impedanceand thus can read as
logic 1/ logic 0 because of minute static charges on nearby objects.
• Pin state changes rapidly and this change is unpredictable.
• This may cause your program to go haywire if it dependson input from
such tri-state pin.
Serial Peripheral Interface (SPI) in AVR Microcontroller
AVR microcontroller support wired communication protocols. Most of the
microcontroller comes with internal modules that support communication
protocols.
The commonly supported protocols in AVR microcontroller are:
o SPI (Serial Peripheral Interface)
o TWI (Two Wire Interface)
o UART (Universal Asynchronous Receiver Transmitter) communication
o USI (Universal Serial Interface)
o USB (Universal Serial Bus)
o Ethernet etc.
SPI is the simplest protocols among all the communication protocols. 8 Bit
data registers inside a device is connected by wires and these data registers
works as shift registers for controlling the data exchange inside the SPI
network. The device or devices that will controls the operation inside the
network is known as the master.
TASKS PERFORMED DURING TRAINING
• GPIO Programming.
• LED interfacing using AVR.
• Button interfacing using AVR.
• Working on keypad with AVR.
• LED Matrix and LED Matrix Display.
• DisplayingAlphabetsand Numbers on LED Matrix using AVR.
• Introductionto Seven Segment with AVR.
• Introductionto Buzzer.
• GLCD Introduction & interfacing with AVR.
• Introductionto ADC.
• Introductionto USART Protocol.
• Interfacing DC Motors with AVR.
Avr report

More Related Content

What's hot

Microprocessor 8051
Microprocessor 8051Microprocessor 8051
Microprocessor 8051Anil Maurya
 
Lecture SOHIL LUHAR
Lecture SOHIL LUHARLecture SOHIL LUHAR
Lecture SOHIL LUHARSOHIL LUHAR
 
Interfacing with Atmega 16
Interfacing with Atmega 16Interfacing with Atmega 16
Interfacing with Atmega 16Ramadan Ramadan
 
MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration AKHIL MADANKAR
 
8051 architecture
8051 architecture8051 architecture
8051 architecturesb108ec
 
A tmega16A Microcontroller Data Sheet
A tmega16A Microcontroller Data SheetA tmega16A Microcontroller Data Sheet
A tmega16A Microcontroller Data SheetMicrotech Solutions
 
8051,chapter1,architecture and peripherals
8051,chapter1,architecture and peripherals8051,chapter1,architecture and peripherals
8051,chapter1,architecture and peripheralsamrutachintawar239
 
Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"surabhii007
 
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheetAtmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheetsang2792
 
AVR Micro controller Interfacing
AVR Micro controller Interfacing AVR Micro controller Interfacing
AVR Micro controller Interfacing Raghav Shetty
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Ganesh Ram
 
PIC introduction + mapping
PIC introduction + mappingPIC introduction + mapping
PIC introduction + mappingOsaMa Hasan
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Sadiq Rahim
 

What's hot (19)

Microprocessor 8051
Microprocessor 8051Microprocessor 8051
Microprocessor 8051
 
AT mega8 basics
AT mega8 basicsAT mega8 basics
AT mega8 basics
 
Lecture SOHIL LUHAR
Lecture SOHIL LUHARLecture SOHIL LUHAR
Lecture SOHIL LUHAR
 
A tmega8 basics
A tmega8 basicsA tmega8 basics
A tmega8 basics
 
8051 microcontrollers ch3
8051 microcontrollers ch38051 microcontrollers ch3
8051 microcontrollers ch3
 
Interfacing with Atmega 16
Interfacing with Atmega 16Interfacing with Atmega 16
Interfacing with Atmega 16
 
MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration
 
PIC CONTROLLERS
PIC CONTROLLERSPIC CONTROLLERS
PIC CONTROLLERS
 
8051 architecture
8051 architecture8051 architecture
8051 architecture
 
A tmega16A Microcontroller Data Sheet
A tmega16A Microcontroller Data SheetA tmega16A Microcontroller Data Sheet
A tmega16A Microcontroller Data Sheet
 
8051,chapter1,architecture and peripherals
8051,chapter1,architecture and peripherals8051,chapter1,architecture and peripherals
8051,chapter1,architecture and peripherals
 
Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"
 
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheetAtmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
 
AVR Micro controller Interfacing
AVR Micro controller Interfacing AVR Micro controller Interfacing
AVR Micro controller Interfacing
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))
 
I/O Ports
I/O Ports I/O Ports
I/O Ports
 
PIC introduction + mapping
PIC introduction + mappingPIC introduction + mapping
PIC introduction + mapping
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
8051
80518051
8051
 

Similar to Avr report

microcontroller basics
microcontroller basicsmicrocontroller basics
microcontroller basicssagar Ramdev
 
Atemega saya
Atemega sayaAtemega saya
Atemega sayasulej77
 
Atmel 8271-8-bit-avr-microcontroller-a tmega48-a-48pa-88a-88pa-168a-168pa-328...
Atmel 8271-8-bit-avr-microcontroller-a tmega48-a-48pa-88a-88pa-168a-168pa-328...Atmel 8271-8-bit-avr-microcontroller-a tmega48-a-48pa-88a-88pa-168a-168pa-328...
Atmel 8271-8-bit-avr-microcontroller-a tmega48-a-48pa-88a-88pa-168a-168pa-328...Rajan Gautam
 
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
 
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
 
Microcontroller
MicrocontrollerMicrocontroller
MicrocontrollerSpitiq
 
ATmegaMicrocontrollerArchitecturenotes.pptx
ATmegaMicrocontrollerArchitecturenotes.pptxATmegaMicrocontrollerArchitecturenotes.pptx
ATmegaMicrocontrollerArchitecturenotes.pptxaartis110
 
Hardware interfacing basics using AVR
Hardware interfacing basics using AVRHardware interfacing basics using AVR
Hardware interfacing basics using AVRMohamed Abdallah
 
Embedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerEmbedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerAmandeep Alag
 
microcontroller 8051 17.07.2023.pdf
microcontroller 8051 17.07.2023.pdfmicrocontroller 8051 17.07.2023.pdf
microcontroller 8051 17.07.2023.pdf818Farida
 
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheetAtmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheetArpan Saha
 

Similar to Avr report (20)

microcontroller basics
microcontroller basicsmicrocontroller basics
microcontroller basics
 
Atemega saya
Atemega sayaAtemega saya
Atemega saya
 
Atmega16 datasheet
Atmega16 datasheetAtmega16 datasheet
Atmega16 datasheet
 
Atmel 8271-8-bit-avr-microcontroller-a tmega48-a-48pa-88a-88pa-168a-168pa-328...
Atmel 8271-8-bit-avr-microcontroller-a tmega48-a-48pa-88a-88pa-168a-168pa-328...Atmel 8271-8-bit-avr-microcontroller-a tmega48-a-48pa-88a-88pa-168a-168pa-328...
Atmel 8271-8-bit-avr-microcontroller-a tmega48-a-48pa-88a-88pa-168a-168pa-328...
 
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
 
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
 
Atmega 32
Atmega 32Atmega 32
Atmega 32
 
Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 
Atmega 8
Atmega 8Atmega 8
Atmega 8
 
Atmega16
Atmega16Atmega16
Atmega16
 
ATmegaMicrocontrollerArchitecturenotes.pptx
ATmegaMicrocontrollerArchitecturenotes.pptxATmegaMicrocontrollerArchitecturenotes.pptx
ATmegaMicrocontrollerArchitecturenotes.pptx
 
digital clock atmega16
digital clock atmega16digital clock atmega16
digital clock atmega16
 
Hardware interfacing basics using AVR
Hardware interfacing basics using AVRHardware interfacing basics using AVR
Hardware interfacing basics using AVR
 
8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf
 
Atmega32
Atmega32Atmega32
Atmega32
 
Embedded systems, 8051 microcontroller
Embedded systems, 8051 microcontrollerEmbedded systems, 8051 microcontroller
Embedded systems, 8051 microcontroller
 
Introduction to PIC.pptx
Introduction to PIC.pptxIntroduction to PIC.pptx
Introduction to PIC.pptx
 
microcontroller 8051 17.07.2023.pdf
microcontroller 8051 17.07.2023.pdfmicrocontroller 8051 17.07.2023.pdf
microcontroller 8051 17.07.2023.pdf
 
unit-2.pptx
unit-2.pptxunit-2.pptx
unit-2.pptx
 
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheetAtmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
 

Recently uploaded

Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementDr. Deepak Mudgal
 
DFT - Discrete Fourier Transform and its Properties
DFT - Discrete Fourier Transform and its PropertiesDFT - Discrete Fourier Transform and its Properties
DFT - Discrete Fourier Transform and its PropertiesShiny Christobel
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxKarpagam Institute of Teechnology
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...ronahami
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxMustafa Ahmed
 
Presentation on Slab, Beam, Column, and Foundation/Footing
Presentation on Slab,  Beam, Column, and Foundation/FootingPresentation on Slab,  Beam, Column, and Foundation/Footing
Presentation on Slab, Beam, Column, and Foundation/FootingEr. Suman Jyoti
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxMustafa Ahmed
 
Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...
Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...
Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...singhalabhi53
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptjigup7320
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesChandrakantDivate1
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
Independent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging StationIndependent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging Stationsiddharthteach18
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...ssuserdfc773
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)ChandrakantDivate1
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Christo Ananth
 
Fundamentals of Structure in C Programming
Fundamentals of Structure in C ProgrammingFundamentals of Structure in C Programming
Fundamentals of Structure in C ProgrammingChandrakantDivate1
 
TMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdf
TMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdf
TMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdfssuserded2d4
 

Recently uploaded (20)

Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
DFT - Discrete Fourier Transform and its Properties
DFT - Discrete Fourier Transform and its PropertiesDFT - Discrete Fourier Transform and its Properties
DFT - Discrete Fourier Transform and its Properties
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptx
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptx
 
Presentation on Slab, Beam, Column, and Foundation/Footing
Presentation on Slab,  Beam, Column, and Foundation/FootingPresentation on Slab,  Beam, Column, and Foundation/Footing
Presentation on Slab, Beam, Column, and Foundation/Footing
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...
Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...
Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
Independent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging StationIndependent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging Station
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
 
Fundamentals of Structure in C Programming
Fundamentals of Structure in C ProgrammingFundamentals of Structure in C Programming
Fundamentals of Structure in C Programming
 
TMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdf
TMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdf
TMU_GDSC_20240509.pdfTMU_GDSC_20240509.pdf
 

Avr report

  • 1. TRAINING REPORT On AVR MICROCONTROLLER DEPTT. OF MECHATRONICS ENGINEERING NITISH KUMAR
  • 2. AVR MICROCONTROLLER The ATmega8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC architecture. By executing powerful instructionsin a single clock cycle, the ATmega8 achieves through puts approaching1 MIPS per MHz, allowingthe system designer to optimize power consumptionversus processing speed. The AVR core combines a rich instruction set with 32 general purpose working registers. All the32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independentregisters to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achievingthroughputs up to ten times faster than conventional CISC microcontrollers. The ATmega8 provides the following features: 8K bytes of In-System Programmable Flash with Read-While-Write capabilities,512 bytes of EEPROM, 1K
  • 3. byte of SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counterswith compare modes, internal and external interrupts, a serial programmable USART, a byte oriented Two wire Serial Interface, a 6-channel ADC (eight channelsin TQFP and QFN/MLF packages) with 10-bit accuracy, a programmable Watchdog Timer with Internal Oscillator,an SPI serial port, and five software selectable power saving modes. The Idle mode stops the CPU while allowingthe SRAM, Timer/Counters, SPI port, and interrupt system to continue functioning.The Power down mode saves the register contents but freezes the Oscillator, disablingall other chip functions untilthe next Interrupt or Hardware Reset. In Power-save mode, the asynchronoustimer continues to run, allowingthe user to maintaina timer base while the rest of the device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except asynchronous timer and ADC, to minimize switching noise during ADC conversions. In Standbymode, the crystal/resonator Oscillatoris runningwhile the rest of the device is sleeping. Thisallows very fast start-up combined with low- power consumption. The device is manufactured using Atmel’s high density non-volatilememory technology. The Flash Program memory can be reprogrammed In-System through
  • 4. an SPI serial interface, by a conventional non-volatilememory programmer, or by an On-chip boot program running on the AVR core. The boot program can use any interface to downloadthe applicationprogram in the ApplicationFlash memory. Software in the Boot Flash Section will continue to run while the Application Flash Section is updated,providing true Read-While-Write operation. By combiningan 8-bit RISC CPU with In-System Self-Programmable Flash on a monolithicchip, the Atmel ATmega8 is a powerful microcontroller that provides a highly-flexibleand cost-effective solution to many embedded control applications. The ATmega8 AVR is supported with a full suite of program and system developmenttools, IncludingC compilers, macro assemblers, program debugger/simulators, In-Circuit Emulators, and evaluation kits.
  • 5. features High-performance, Low-power AVR® 8-bit Microcontroller • Advanced RISC Architecture – 130 Powerful Instructions – Most Single-clock Cycle Execution – 32 x 8 General Purpose Working Registers – Fully Static Operation – Up to 16 MIPS Throughput at 16 MHz
  • 6. – On-chip 2-cycle Multiplier • High Endurance Non-volatile Memory segments – 8K Bytes of In-System Self-programmableFlash program memory – 512 Bytes EEPROM – 1K Byte Internal SRAM – Write/Erase Cycles: 10,000 Flash/100,000 EEPROM – Data retention: 20 years at 85°C/100 years at 25°C(1) – Optional Boot Code Section with Independent Lock Bits In-System Programmingby On-chip Boot Program True Read-While-Write Operation – ProgrammingLock for Software Security • Peripheral Features – Two 8-bit Timer/Counterswith Separate Prescaler, one Compare Mode – One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode – Real Time Counter with Separate Oscillator
  • 7. – Three PWM Channels – 8-channel ADC in TQFP and QFN/MLF package Eight Channels 10-bit Accuracy – 6-channel ADC in PDIP package Six Channels 10-bit Accuracy – Byte-oriented Two-wire Serial Interface – Programmable Serial USART – Master/Slave SPI Serial Interface – Programmable Watchdog Timer with Separate On-chip Oscillator – On-chip Analog Comparator • Special Microcontroller Features – Power-on Reset and ProgrammableBrown-out Detection – Internal Calibrated RC Oscillator – External and Internal Interrupt Sources – Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, and Standby
  • 8. • I/O and Packages – 23 ProgrammableI/O Lines – 28-lead PDIP, 32-lead TQFP, and 32-pad QFN/MLF • Operating Voltages – 2.7 - 5.5V (ATmega8L) – 4.5 - 5.5V (ATmega8) • Speed Grades – 0 - 8 MHz (ATmega8L) – 0 - 16 MHz (ATmega8) • Power Consumption at 4 Mhz, 3V, 25°C – Active: 3.6 mA – Idle Mode: 1.0 mA – Power-down Mode: 0.5 Μa
  • 10. USES OF DIFFERENT PINS OF ATMEGA8
  • 11. One of the most important features of ATmega8 microcontroller is that except 5 pins, all other pins can be used for supporting two signals. o Pins 9,10,14,15,16,17,18,19 are used for port B, Whereas Pins 23,24,25,26,27,28 and 1 are used for port C and Pins 2,3,4,5,6,11,12 are used for port D. o Pin 1 is used as Reset pin and on applyinglow level signal for time longer than minimum pulse length will generate a reset signal. o Pins 3 and 2 can also be used in serial communication for USART (Universal Synchronous and Asynchronous Receiver Transmitter). o Pin 5 and 4 are used as external interrupts. o Pins 10 and9 are used as timer counteroscillatorsas well as external oscillator where the crystal is connected directly between the pins. o Pin 19 is used as slave clock input or master clock output for Serial Peripheral Interface (SPI) channel. o Pin 18 is used as slave clock output or master clock input o Pins 23 to 28 are used for analog to digital conversion (ADC) channels. o Pin 12 and 13 are used as Analog Comparator inputs.
  • 12. o Pins 6 and 11 are used as counter/timer sources. TOOLS • Compiler : WinAVR/AVR Studio/CodeVision AVR • The programmer hardware - Simple parallel/serialport based In System Programmer (ISP) or - USB based ISP (recommended) : USBasp • Bread board, wires, power supply, crystal, etc
  • 13. POINTSTOBENOTED • PORT : group of 8 pins, or set of pinsused for exchanging data with external world • Width of almost all registers : 8 bits (some 16 bits) • In port related registers, every bit corresponds to one pin of the port. Bit 0 corresponds to Pin 0 Bit 0 corresponds to Pin 1 .. Etc • Remember direct one to one correspondence between HEX and BINARY numbers. 0xFF = 1111 1111 0xAA = 1010 1010 0x11 = 0001 0001
  • 14. INPUT/OUTPUTBASICS ATmega8 microcontroller consists of 3 I/O ports, named as B, C and D with a combination of 23 I/O lines. Port D consists of 8 I/O lines, Port C consists of 7 I/O lines, and Port B consists of 8 I/O lines. Registers corresponding to the Input/output port X (B, C or D) are: o DDRX: Data Direction Register of Port X (for configuring Data Direction (input/output) of the port pins.) o PORTX: Dataregister of Port X (for writing the values to the port pinsinoutput mode. Configuring the port pins in input mode.) o PINX: Input register of Port X (reading data from port pins in input mode) o Where x : A,B,C,D… depending on the available ports in your AVR.
  • 15.
  • 16. DDR-DATADIRECTIONREGISTER • Configures data direction of the port - Input / Output • DDRx.n = 0 > makes corresponding port pin as input DDRx.n = 1 > makes corresponding port pin as output • Examples : • to make all pins of port A as input pins: DDRA = 0b00000000; • to make all pins of port A as output pins DDRA = 0b11111111; • to make lower nibbleof port B as output and higher nibbleas input DDRB = 0b00001111;
  • 17. PINREGISTER • Used to read data from port pins, when port is configured as input. • First set DDRx to zero, then use PINx to read the value. • If PINx is read, when port is configured as output, it will give you data that has been outputted on port. • There two input modes : - Tristated input - Pullup input This will be explainedshortly • Example : DDRA = 0x00; //Set PA as input x = PINA; //Read contents of PA
  • 18. PORTREGISTER • Used for two purposes … 1) for data output, when port is configured as output: • Writing to PORTx.n will immediately(in same clock cycle) change state of the port pinsaccording to given value. • Do not forget to load DDRx with appropriatevalue for configuring port pins as output. • Examples : • to output 0xFF data on PB DDRB = 0b11111111; port b as outputs //set all pins of PORTB = 0xFF; //write data on port • to output data in variablex on PA DDRA = 0xFF; //make port a as output PORTA = x; //output 8 bit variable on port
  • 19. 2) for configuring pin as tristate/pullup, when port is configured as input) : • When port is configures as input (i.e DDRx.n=1), then PORTx.n controls the internalpull-up resistor. • PORTx.n = 1 : Enables pullupfor nth bit PORTx.n = 0 : Disables pullupfor nth bit, thus making it tristate • Examples : • to make PA as input with pull-upsenabled and read data from PA DDRA = 0x00; //make port a as input PORTA = 0xFF; //enable all pull-ups y = PINA; //read data from port a pins • to make PB as tri stated input DDRB = 0x00; //make port b as input PORTB = 0x00; //disable pull-ups and make it tri state
  • 20. What is pull-up ? • Pull-up resistor is used to ensure that tri-stated input alwaysreads HIGH (1) when it is not driven by any external entity. • Pull-up is very important when you are using tri-stated input buffers. • Tri-state input pin offers very high impedanceand thus can read as logic 1/ logic 0 because of minute static charges on nearby objects. • Pin state changes rapidly and this change is unpredictable. • This may cause your program to go haywire if it dependson input from such tri-state pin.
  • 21. Serial Peripheral Interface (SPI) in AVR Microcontroller AVR microcontroller support wired communication protocols. Most of the microcontroller comes with internal modules that support communication protocols. The commonly supported protocols in AVR microcontroller are: o SPI (Serial Peripheral Interface) o TWI (Two Wire Interface) o UART (Universal Asynchronous Receiver Transmitter) communication o USI (Universal Serial Interface) o USB (Universal Serial Bus) o Ethernet etc. SPI is the simplest protocols among all the communication protocols. 8 Bit data registers inside a device is connected by wires and these data registers
  • 22. works as shift registers for controlling the data exchange inside the SPI network. The device or devices that will controls the operation inside the network is known as the master. TASKS PERFORMED DURING TRAINING • GPIO Programming. • LED interfacing using AVR. • Button interfacing using AVR. • Working on keypad with AVR. • LED Matrix and LED Matrix Display. • DisplayingAlphabetsand Numbers on LED Matrix using AVR. • Introductionto Seven Segment with AVR. • Introductionto Buzzer. • GLCD Introduction & interfacing with AVR. • Introductionto ADC. • Introductionto USART Protocol. • Interfacing DC Motors with AVR.