SlideShare uma empresa Scribd logo
1 de 27
BY - SAYAK CHOUDHURY
BRANCH - EEE
ROLL No. 1007160
MAIN FEATURES


High-performance, Low-power , 8-bit Microcontroller



Advanced RISC Architecture



131 Powerful Instructions – Most Single-clock Cycle Execution



32 x 8 General Purpose Working Registers



Fully Static Operation



Nonvolatile Program and Data Memories



16K Bytes of In-System Self-Programmable Flash



Endurance: 10,000 Write/Erase Cycles



True Read-While-Write Operation



512 Bytes EEPROM



1K Byte Internal SRAM



On-chip Analog Comparator



Programming Lock for Software Security



JTAG (IEEE std. 1149.1 Compliant) Interface



Boundary-scan Capabilities According to the JTAG Standard



Extensive On-chip Debug Support



Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG
Interface
MAIN FEATURES CONTD…


Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes



One 16-bit Timer/Counter with Separate Prescaler & Compare Mode



Real Time Counter with Separate Oscillator



Four PWM Channels



8-channel, 10-bit ADC



2 Differential Channels with Programmable Gain at 1x, 10x, or 200x



Byte-oriented Two-wire Serial Interface



Programmable Serial USART



Master/Slave Serial Interface



Power-on Reset



Internal Calibrated RC Oscillator



External and Internal Interrupt Sources



Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby
and Extended Standby



40-pin PDIP, 44-lead TQFP, and 44-pad MLF Package



Operating Voltage 4.5 - 5.5V



Speed Grades 0 - 16 MHz
PIN CONFIGURATION
ATMEGA 16 DATASHEET
DATA SHEET
Now the most important part of Atmega 16
How to use Atmega 16 microcontroller in
embedded system?
What is embedded system?

Why embedded system used?
Where embedded systems are used?
HARDWARE AND SOFTWARE
REQUIRED


Hardware:
1.Atmega16 microcontroller
2.IC 7805
3.USB AVR programmer

4.Other interfacing devices


Software:
1.Win AVR
2.AVR Studio 4
HOW TO WRITE ON A BIT OR READ FROM
BIT






Set the bit PX0 as input or output by
DDRX|=(1<<0) to set PX0 as output and
DDRX&=~(1<<0) to set PX0 as input pin
Write something on the bit PX0 by
PORTX|=(1<<0) to write 1 on PX0
PORTX&=~(1<<0) to write 0 on PX0
Read from the bit PX0 by
Unsigned int h;
h=PINX; h&=(1<<0);
Then h will be the data present in the PX0
pin.
HOW TO SET AND RESET A BIT
Suppose we have to set PX0 then write
 PORTX |=(1<<0) or PORTX|=_BV(PX0)
PORTX=0bddddddd1 or PORTX = 1


PORTX=0xd1 or

Now suppose we have to reset PX0 then write
 PORTX &=~(1<<0) or PORTX&=~(_BV(PX0)) PORTX= 0xd0 or
PORTX=0bddddddd0 or PORTX = 0


Here ‘d ‘ denotes the don’t care
 First 2 ways are convenient because the other bits are not
affected by this way

HOW TO TOGGLE A BIT










Now suppose we have to toggle PB0 with a delay of 500ms
Put a delay header file by
#include<util/delay.h>
PORTB =^(1<<0) ;_delay_ms(500); or
PORTB=^(_BV(PB0)) ;_delay_ms(500);or
PORTB=0xd1;_delay_ms(500);
PORTB=0xd0;_delay_ms(500);or
PORTB=0bddddddd1; _delay_ms(500);
PORTB=0bddddddd0; _delay_ms(500);or
PORTB=1; _delay_ms(500);
PORTB=0;_delay_ms(500);
Here also the first two ways are convenient because of the
same reason.
EEPROM


Code to write data to EEPROM

Void write(unsigned int add,unsigned char data)
{ wait();
while(EECR&(1<<EEWE));

EEAR=add;
EEDR=data;
EECR|=(1<<EEMWE);
EECR|=(1<<EEWE);
}


Code to read data from EEPROM

Unsigned char read(unsigned int add)
{ wait();
while(EECR&(1<<EEWE));

EEAR=add;
EECR|=(1<<EERE);
return EEDR;
}
SUT is used to control the
frequency at low frequency

CKSEL =1
to 4

CKSEL = 5 to
8
CKSEL = 0

CKSEL = A

CKSEL=9
MODES AND POWER MANAGEMENT
MCUCR is the register responsible for determining
the mode of operation.
SYSTEM CONTROL & RESET
POWER ON RESET
2.
EXTERNAL RESET
3.
BROWN OUT DETECTION Typical time out of WDT for 5V
VCC is
4.
WATCHDOG RESET
16.3ms to 2.1sec
5.
JTAG RESET
MCUCSR register defines the reset condition and
cause of reset
Watchdog timer control register(WDTCR)
1.

--------

--------

-------- WDTOE

WDE

WDP2

WDP1

WDP0
USART
USART CONTD…
USART CONTD…
PROGRAMMING CONCEPT
#include <avr/io.h>
#include <inttypes.h>
void USARTInit(uint16_t ubrr_value){
UBRRL = ubrr_value;
UBRRH = (ubrr_value>>8);
UCSRC=(1<<URSEL)|(3<<UCSZ0);
UCSRB=(1<<RXEN)|(1<<TXEN);}
char USARTReadChar(){
while(!(UCSRA & (1<<RXC))){}
return UDR;}
void USARTWriteChar(char data){
while(!(UCSRA & (1<<UDRE))){}
UDR=data;}

This function is used to set
baud rate and initialize the
USART communication

This function is used to read data
from RXD pin
This function is used to write data
to TXD pin
USART CONTD…
void main()
{
char data;
USARTInit(103); //UBRR = 103
while(1)
{
DDRB=0xFF;
data=USARTReadChar();
PORTB=data;
};
Return 0;
}


One more thing windows hyperterminal is required, where
we have to put the communication port number and baud
rate taking the data from device manager of the PC after
connecting ATMEGA16
TWO WIRE INTERFACE(TWI)


This is the interconnection of one AVR
microcontroller with several AVR microcontrollers.
…….
DEVICE

1

DEVICE
2

DEVICE
3

DEVICE
4

DEVICE
n

SDA
SCL
JTAG
JTAG CONTD…
 The

JTAGEN fuse must be programmed and
the JTD bit in the MCUSR Register must be
cleared to enable the JTAG Test Access Port.
 The JTAG programming capability supports:
1.
Flash programming and verifying
2. EEPROM programming and verifying
3. Fuse programming and verifying
4. Lock bit programming and verifying
Now, What is boundary scan?
Why we have to use JTAG?
What is device identification register?
REST OF THE TOPICS CAN BE VISUALIZED
BY PROTEUS8.0 SOFTWARE THAT’S WHY
EXPLAINED BY DEMO OF SOME PROJECTS
The topics are:
1. TIMER /COUNTER
2. PULSE WIDTH MODULATION
3. ANALOG TO DIGITAL CONVERSION
4. COMPARATOR
5. USART
6. LCD INTERFACE
7. KEYBOARD INTERFACE
8. MOTOR INTERFACE
SOME INTERESTING PROJECTS
1.LED traffic control with ATMEGA16 simple code

2.Analog comparator and LED glow
SOME INTERESTING PROJECTS CONTD...
3.Temperature display using Interrupt, ADC and LCD
interface

4.USART communication using hyperterminal to see the
ASCII value of any character
SOME INTERESTING PROJECTS CONTD...
5.Line follower Robot using ADC, Motor interface, PWM
and timer/counter and LCD interface

6.Password protected door lock system using keyboard
interface, motor interface and LCD interface
THANK YOU

Mais conteúdo relacionado

Mais procurados

Advance Microcontroller AVR
Advance Microcontroller AVRAdvance Microcontroller AVR
Advance Microcontroller AVRDaksh Raj Chopra
 
Msp 430 architecture module 1
Msp 430 architecture module 1Msp 430 architecture module 1
Msp 430 architecture module 1SARALA T
 
Introduction to AVR Microcontroller
Introduction to AVR Microcontroller Introduction to AVR Microcontroller
Introduction to AVR Microcontroller Mahmoud Sadat
 
Overview of LPC213x MCUs
Overview of LPC213x MCUsOverview of LPC213x MCUs
Overview of LPC213x MCUsPremier Farnell
 
3 embedded gr_ppapag_msp430_arch
3 embedded gr_ppapag_msp430_arch3 embedded gr_ppapag_msp430_arch
3 embedded gr_ppapag_msp430_archchandrika
 
AVR_Course_Day4 introduction to microcontroller
AVR_Course_Day4 introduction to microcontrollerAVR_Course_Day4 introduction to microcontroller
AVR_Course_Day4 introduction to microcontrollerMohamed Ali
 
ATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part IATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part IVineethMP2
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontrollerRAMPRAKASHT1
 
Introduction to msp430
Introduction to msp430Introduction to msp430
Introduction to msp430Harsha herle
 
Arm cortex (lpc 2148) based motor speed
Arm cortex (lpc 2148) based motor speedArm cortex (lpc 2148) based motor speed
Arm cortex (lpc 2148) based motor speedUday Wankar
 
Block diagram of msp430x5xx
Block diagram of msp430x5xxBlock diagram of msp430x5xx
Block diagram of msp430x5xxRAMYASREEKUPPALA
 
AVR Micro controller Interfacing
AVR Micro controller Interfacing AVR Micro controller Interfacing
AVR Micro controller Interfacing Raghav Shetty
 
GPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-cGPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-cZakaria Gomaa
 

Mais procurados (20)

Micro-controller course lec 01
Micro-controller course lec 01Micro-controller course lec 01
Micro-controller course lec 01
 
Advance Microcontroller AVR
Advance Microcontroller AVRAdvance Microcontroller AVR
Advance Microcontroller AVR
 
Msp 430 architecture module 1
Msp 430 architecture module 1Msp 430 architecture module 1
Msp 430 architecture module 1
 
Introduction to AVR Microcontroller
Introduction to AVR Microcontroller Introduction to AVR Microcontroller
Introduction to AVR Microcontroller
 
ATMEGA 328
ATMEGA 328ATMEGA 328
ATMEGA 328
 
Msp430
Msp430Msp430
Msp430
 
Overview of LPC213x MCUs
Overview of LPC213x MCUsOverview of LPC213x MCUs
Overview of LPC213x MCUs
 
3 embedded gr_ppapag_msp430_arch
3 embedded gr_ppapag_msp430_arch3 embedded gr_ppapag_msp430_arch
3 embedded gr_ppapag_msp430_arch
 
AVR_Course_Day4 introduction to microcontroller
AVR_Course_Day4 introduction to microcontrollerAVR_Course_Day4 introduction to microcontroller
AVR_Course_Day4 introduction to microcontroller
 
ATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part IATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part I
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontroller
 
Introduction to msp430
Introduction to msp430Introduction to msp430
Introduction to msp430
 
Avr and arm
Avr and armAvr and arm
Avr and arm
 
Arm cortex (lpc 2148) based motor speed
Arm cortex (lpc 2148) based motor speedArm cortex (lpc 2148) based motor speed
Arm cortex (lpc 2148) based motor speed
 
Pic full note
Pic full notePic full note
Pic full note
 
Block diagram of msp430x5xx
Block diagram of msp430x5xxBlock diagram of msp430x5xx
Block diagram of msp430x5xx
 
AVR Micro controller Interfacing
AVR Micro controller Interfacing AVR Micro controller Interfacing
AVR Micro controller Interfacing
 
GPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-cGPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-c
 
Atmega32
Atmega32Atmega32
Atmega32
 
Dsp on an-avr
Dsp on an-avrDsp on an-avr
Dsp on an-avr
 

Destaque

Annual report of activities of IEEE Malabar subsection 2014
Annual report of activities of IEEE Malabar subsection 2014Annual report of activities of IEEE Malabar subsection 2014
Annual report of activities of IEEE Malabar subsection 2014Prof. Mohandas K P
 
CURRICULUM VITAE2.new update
CURRICULUM VITAE2.new updateCURRICULUM VITAE2.new update
CURRICULUM VITAE2.new updateIrish Fajardo
 
Presidents Report June 2013
Presidents Report June 2013Presidents Report June 2013
Presidents Report June 2013aqignacio
 
7 segment interface with avr microcontroller
7 segment interface with avr microcontroller7 segment interface with avr microcontroller
7 segment interface with avr microcontrollerKushagra Ganeriwal
 
Mikroc pro avr_manual_v100
Mikroc pro avr_manual_v100Mikroc pro avr_manual_v100
Mikroc pro avr_manual_v100EEMPROM
 
Presentation of Oracle database products
Presentation of Oracle database productsPresentation of Oracle database products
Presentation of Oracle database productsAlgiers Tech Meetup
 
Crossing Guard Training Module 5 Techniques
Crossing Guard Training Module 5 TechniquesCrossing Guard Training Module 5 Techniques
Crossing Guard Training Module 5 TechniquesIowa Bicycle Coalition
 
Traffic light controller
Traffic light controllerTraffic light controller
Traffic light controllernimmi_abes
 
A four way autometic traffic control system with variable delay using hdl
A four way autometic traffic control system with variable delay using hdlA four way autometic traffic control system with variable delay using hdl
A four way autometic traffic control system with variable delay using hdleSAT Journals
 
C from hello world to 010101
C from hello world to 010101C from hello world to 010101
C from hello world to 010101Bellaj Badr
 
Ecg Part 1
Ecg Part 1Ecg Part 1
Ecg Part 1hospital
 
AndrewCesarRimandoProfile20160705
AndrewCesarRimandoProfile20160705AndrewCesarRimandoProfile20160705
AndrewCesarRimandoProfile20160705Andrew Rimando
 
Atmega32 avr.com-projects
Atmega32 avr.com-projectsAtmega32 avr.com-projects
Atmega32 avr.com-projectsdahlia2sally
 
THE DESIGN AND IMPLEMENTATION OF A FOUR – WAY TRAFFIC LIGHT
THE DESIGN AND IMPLEMENTATION OF A FOUR – WAY TRAFFIC LIGHT THE DESIGN AND IMPLEMENTATION OF A FOUR – WAY TRAFFIC LIGHT
THE DESIGN AND IMPLEMENTATION OF A FOUR – WAY TRAFFIC LIGHT Stephen Achionye
 
Programming pic microcontrollers
Programming pic microcontrollersProgramming pic microcontrollers
Programming pic microcontrollersMAIYO JOSPHAT
 

Destaque (20)

Annual report of activities of IEEE Malabar subsection 2014
Annual report of activities of IEEE Malabar subsection 2014Annual report of activities of IEEE Malabar subsection 2014
Annual report of activities of IEEE Malabar subsection 2014
 
CURRICULUM VITAE2.new update
CURRICULUM VITAE2.new updateCURRICULUM VITAE2.new update
CURRICULUM VITAE2.new update
 
Presidents Report June 2013
Presidents Report June 2013Presidents Report June 2013
Presidents Report June 2013
 
8051 presentation
8051 presentation8051 presentation
8051 presentation
 
7 segment interface with avr microcontroller
7 segment interface with avr microcontroller7 segment interface with avr microcontroller
7 segment interface with avr microcontroller
 
Mikroc pro avr_manual_v100
Mikroc pro avr_manual_v100Mikroc pro avr_manual_v100
Mikroc pro avr_manual_v100
 
γιατι να διαβασω ιλιαδα
γιατι να διαβασω ιλιαδαγιατι να διαβασω ιλιαδα
γιατι να διαβασω ιλιαδα
 
Presentation of Oracle database products
Presentation of Oracle database productsPresentation of Oracle database products
Presentation of Oracle database products
 
Crossing Guard Training Module 5 Techniques
Crossing Guard Training Module 5 TechniquesCrossing Guard Training Module 5 Techniques
Crossing Guard Training Module 5 Techniques
 
Traffic light controller
Traffic light controllerTraffic light controller
Traffic light controller
 
A four way autometic traffic control system with variable delay using hdl
A four way autometic traffic control system with variable delay using hdlA four way autometic traffic control system with variable delay using hdl
A four way autometic traffic control system with variable delay using hdl
 
Ai 150 architecture
Ai 150 architectureAi 150 architecture
Ai 150 architecture
 
Training report on embedded sys_AVR
Training report on embedded sys_AVRTraining report on embedded sys_AVR
Training report on embedded sys_AVR
 
C from hello world to 010101
C from hello world to 010101C from hello world to 010101
C from hello world to 010101
 
Traffic light controller
Traffic light controllerTraffic light controller
Traffic light controller
 
Ecg Part 1
Ecg Part 1Ecg Part 1
Ecg Part 1
 
AndrewCesarRimandoProfile20160705
AndrewCesarRimandoProfile20160705AndrewCesarRimandoProfile20160705
AndrewCesarRimandoProfile20160705
 
Atmega32 avr.com-projects
Atmega32 avr.com-projectsAtmega32 avr.com-projects
Atmega32 avr.com-projects
 
THE DESIGN AND IMPLEMENTATION OF A FOUR – WAY TRAFFIC LIGHT
THE DESIGN AND IMPLEMENTATION OF A FOUR – WAY TRAFFIC LIGHT THE DESIGN AND IMPLEMENTATION OF A FOUR – WAY TRAFFIC LIGHT
THE DESIGN AND IMPLEMENTATION OF A FOUR – WAY TRAFFIC LIGHT
 
Programming pic microcontrollers
Programming pic microcontrollersProgramming pic microcontrollers
Programming pic microcontrollers
 

Semelhante a Seminar

Microcontroller
MicrocontrollerMicrocontroller
MicrocontrollerSpitiq
 
Training Report on embedded Systems and Robotics
Training Report on embedded  Systems and RoboticsTraining Report on embedded  Systems and Robotics
Training Report on embedded Systems and RoboticsNIT Raipur
 
Universal Asynchronous Receive and transmit IP core
Universal Asynchronous Receive and transmit IP coreUniversal Asynchronous Receive and transmit IP core
Universal Asynchronous Receive and transmit IP coreAneesh Raveendran
 
The presentation is about USART and serial communication
The presentation is about USART and serial communicationThe presentation is about USART and serial communication
The presentation is about USART and serial communicationsinaankhalil
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver艾鍗科技
 
project report on embedded system
project report on embedded systemproject report on embedded system
project report on embedded systemram avtar
 
Hacking the 2016 Hackaday SuperConference Badge
Hacking the 2016 Hackaday SuperConference BadgeHacking the 2016 Hackaday SuperConference Badge
Hacking the 2016 Hackaday SuperConference Badgeszczys
 
AVR Fundamentals
AVR FundamentalsAVR Fundamentals
AVR FundamentalsVinit Vyas
 
FAR/MARS Avionics CDR
FAR/MARS Avionics CDRFAR/MARS Avionics CDR
FAR/MARS Avionics CDRCade Walton
 
Best-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbaiBest-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbaiUnmesh Baile
 

Semelhante a Seminar (20)

Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 
amba.ppt
amba.pptamba.ppt
amba.ppt
 
amba.ppt
amba.pptamba.ppt
amba.ppt
 
amba.ppt
amba.pptamba.ppt
amba.ppt
 
amba (1).ppt
amba (1).pptamba (1).ppt
amba (1).ppt
 
Training Report on embedded Systems and Robotics
Training Report on embedded  Systems and RoboticsTraining Report on embedded  Systems and Robotics
Training Report on embedded Systems and Robotics
 
Universal Asynchronous Receive and transmit IP core
Universal Asynchronous Receive and transmit IP coreUniversal Asynchronous Receive and transmit IP core
Universal Asynchronous Receive and transmit IP core
 
The presentation is about USART and serial communication
The presentation is about USART and serial communicationThe presentation is about USART and serial communication
The presentation is about USART and serial communication
 
An Example MIPS
An Example  MIPSAn Example  MIPS
An Example MIPS
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
 
project report on embedded system
project report on embedded systemproject report on embedded system
project report on embedded system
 
Presentation
PresentationPresentation
Presentation
 
Hacking the 2016 Hackaday SuperConference Badge
Hacking the 2016 Hackaday SuperConference BadgeHacking the 2016 Hackaday SuperConference Badge
Hacking the 2016 Hackaday SuperConference Badge
 
AVR Fundamentals
AVR FundamentalsAVR Fundamentals
AVR Fundamentals
 
Iot Workshop NITT 2015
Iot Workshop NITT 2015Iot Workshop NITT 2015
Iot Workshop NITT 2015
 
FAR/MARS Avionics CDR
FAR/MARS Avionics CDRFAR/MARS Avionics CDR
FAR/MARS Avionics CDR
 
Chp 2 and 3.pptx
Chp 2 and 3.pptxChp 2 and 3.pptx
Chp 2 and 3.pptx
 
digital clock atmega16
digital clock atmega16digital clock atmega16
digital clock atmega16
 
Best-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbaiBest-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbai
 
Avr microcontroller
Avr microcontrollerAvr microcontroller
Avr microcontroller
 

Seminar

  • 1. BY - SAYAK CHOUDHURY BRANCH - EEE ROLL No. 1007160
  • 2. MAIN FEATURES  High-performance, Low-power , 8-bit Microcontroller  Advanced RISC Architecture  131 Powerful Instructions – Most Single-clock Cycle Execution  32 x 8 General Purpose Working Registers  Fully Static Operation  Nonvolatile Program and Data Memories  16K Bytes of In-System Self-Programmable Flash  Endurance: 10,000 Write/Erase Cycles  True Read-While-Write Operation  512 Bytes EEPROM  1K Byte Internal SRAM  On-chip Analog Comparator  Programming Lock for Software Security  JTAG (IEEE std. 1149.1 Compliant) Interface  Boundary-scan Capabilities According to the JTAG Standard  Extensive On-chip Debug Support  Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface
  • 3. MAIN FEATURES CONTD…  Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes  One 16-bit Timer/Counter with Separate Prescaler & Compare Mode  Real Time Counter with Separate Oscillator  Four PWM Channels  8-channel, 10-bit ADC  2 Differential Channels with Programmable Gain at 1x, 10x, or 200x  Byte-oriented Two-wire Serial Interface  Programmable Serial USART  Master/Slave Serial Interface  Power-on Reset  Internal Calibrated RC Oscillator  External and Internal Interrupt Sources  Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby  40-pin PDIP, 44-lead TQFP, and 44-pad MLF Package  Operating Voltage 4.5 - 5.5V  Speed Grades 0 - 16 MHz
  • 5.
  • 6. ATMEGA 16 DATASHEET DATA SHEET Now the most important part of Atmega 16 How to use Atmega 16 microcontroller in embedded system? What is embedded system? Why embedded system used? Where embedded systems are used?
  • 7. HARDWARE AND SOFTWARE REQUIRED  Hardware: 1.Atmega16 microcontroller 2.IC 7805 3.USB AVR programmer 4.Other interfacing devices  Software: 1.Win AVR 2.AVR Studio 4
  • 8. HOW TO WRITE ON A BIT OR READ FROM BIT    Set the bit PX0 as input or output by DDRX|=(1<<0) to set PX0 as output and DDRX&=~(1<<0) to set PX0 as input pin Write something on the bit PX0 by PORTX|=(1<<0) to write 1 on PX0 PORTX&=~(1<<0) to write 0 on PX0 Read from the bit PX0 by Unsigned int h; h=PINX; h&=(1<<0); Then h will be the data present in the PX0 pin.
  • 9. HOW TO SET AND RESET A BIT Suppose we have to set PX0 then write  PORTX |=(1<<0) or PORTX|=_BV(PX0) PORTX=0bddddddd1 or PORTX = 1  PORTX=0xd1 or Now suppose we have to reset PX0 then write  PORTX &=~(1<<0) or PORTX&=~(_BV(PX0)) PORTX= 0xd0 or PORTX=0bddddddd0 or PORTX = 0  Here ‘d ‘ denotes the don’t care  First 2 ways are convenient because the other bits are not affected by this way 
  • 10. HOW TO TOGGLE A BIT       Now suppose we have to toggle PB0 with a delay of 500ms Put a delay header file by #include<util/delay.h> PORTB =^(1<<0) ;_delay_ms(500); or PORTB=^(_BV(PB0)) ;_delay_ms(500);or PORTB=0xd1;_delay_ms(500); PORTB=0xd0;_delay_ms(500);or PORTB=0bddddddd1; _delay_ms(500); PORTB=0bddddddd0; _delay_ms(500);or PORTB=1; _delay_ms(500); PORTB=0;_delay_ms(500); Here also the first two ways are convenient because of the same reason.
  • 11. EEPROM  Code to write data to EEPROM Void write(unsigned int add,unsigned char data) { wait(); while(EECR&(1<<EEWE)); EEAR=add; EEDR=data; EECR|=(1<<EEMWE); EECR|=(1<<EEWE); }  Code to read data from EEPROM Unsigned char read(unsigned int add) { wait(); while(EECR&(1<<EEWE)); EEAR=add; EECR|=(1<<EERE); return EEDR; }
  • 12. SUT is used to control the frequency at low frequency CKSEL =1 to 4 CKSEL = 5 to 8 CKSEL = 0 CKSEL = A CKSEL=9
  • 13. MODES AND POWER MANAGEMENT MCUCR is the register responsible for determining the mode of operation.
  • 14. SYSTEM CONTROL & RESET POWER ON RESET 2. EXTERNAL RESET 3. BROWN OUT DETECTION Typical time out of WDT for 5V VCC is 4. WATCHDOG RESET 16.3ms to 2.1sec 5. JTAG RESET MCUCSR register defines the reset condition and cause of reset Watchdog timer control register(WDTCR) 1. -------- -------- -------- WDTOE WDE WDP2 WDP1 WDP0
  • 15. USART
  • 17. USART CONTD… PROGRAMMING CONCEPT #include <avr/io.h> #include <inttypes.h> void USARTInit(uint16_t ubrr_value){ UBRRL = ubrr_value; UBRRH = (ubrr_value>>8); UCSRC=(1<<URSEL)|(3<<UCSZ0); UCSRB=(1<<RXEN)|(1<<TXEN);} char USARTReadChar(){ while(!(UCSRA & (1<<RXC))){} return UDR;} void USARTWriteChar(char data){ while(!(UCSRA & (1<<UDRE))){} UDR=data;} This function is used to set baud rate and initialize the USART communication This function is used to read data from RXD pin This function is used to write data to TXD pin
  • 18. USART CONTD… void main() { char data; USARTInit(103); //UBRR = 103 while(1) { DDRB=0xFF; data=USARTReadChar(); PORTB=data; }; Return 0; }  One more thing windows hyperterminal is required, where we have to put the communication port number and baud rate taking the data from device manager of the PC after connecting ATMEGA16
  • 19. TWO WIRE INTERFACE(TWI)  This is the interconnection of one AVR microcontroller with several AVR microcontrollers. ……. DEVICE 1 DEVICE 2 DEVICE 3 DEVICE 4 DEVICE n SDA SCL
  • 20.
  • 21. JTAG
  • 22. JTAG CONTD…  The JTAGEN fuse must be programmed and the JTD bit in the MCUSR Register must be cleared to enable the JTAG Test Access Port.  The JTAG programming capability supports: 1. Flash programming and verifying 2. EEPROM programming and verifying 3. Fuse programming and verifying 4. Lock bit programming and verifying Now, What is boundary scan? Why we have to use JTAG? What is device identification register?
  • 23. REST OF THE TOPICS CAN BE VISUALIZED BY PROTEUS8.0 SOFTWARE THAT’S WHY EXPLAINED BY DEMO OF SOME PROJECTS The topics are: 1. TIMER /COUNTER 2. PULSE WIDTH MODULATION 3. ANALOG TO DIGITAL CONVERSION 4. COMPARATOR 5. USART 6. LCD INTERFACE 7. KEYBOARD INTERFACE 8. MOTOR INTERFACE
  • 24. SOME INTERESTING PROJECTS 1.LED traffic control with ATMEGA16 simple code 2.Analog comparator and LED glow
  • 25. SOME INTERESTING PROJECTS CONTD... 3.Temperature display using Interrupt, ADC and LCD interface 4.USART communication using hyperterminal to see the ASCII value of any character
  • 26. SOME INTERESTING PROJECTS CONTD... 5.Line follower Robot using ADC, Motor interface, PWM and timer/counter and LCD interface 6.Password protected door lock system using keyboard interface, motor interface and LCD interface

Notas do Editor

  1. DATA SHEET PAGE 23