• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Led pattern 8 with avr atmega16 microcontroller Circuit diagram and C program/ C code ablab solutions
 

Led pattern 8 with avr atmega16 microcontroller Circuit diagram and C program/ C code ablab solutions

on

  • 1,692 views

 

Statistics

Views

Total Views
1,692
Views on SlideShare
1,692
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Led pattern 8 with avr atmega16 microcontroller Circuit diagram and C program/ C code ablab solutions Led pattern 8 with avr atmega16 microcontroller Circuit diagram and C program/ C code ablab solutions Document Transcript

    • ABLab Solutions LED pattern 8 with ATmega16 1
    • ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 Table of Contents Project Description .................................................................................................... 3 Hardwares Required .................................................................................................. 3 Softwares Required ................................................................................................... 3 C Program.................................................................................................................. 4 Connection Guide ...................................................................................................... 5 Update Yourself......................................................................................................... 6 2
    • ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 Project Description In this project, we will connect 8 LEDs to ATmega16 microcontroller. Then, we will generate a pattern with the 8 LEDs. The pattern is shown in below diagram: 0 1 2 3 4 5 6 7 LED Position x x x x x x x x * x x x x x x * * * x x x x * * * * * x x * * * * * * * * * * * In above diagram, * means LED is on and x means LED is off. The time interval between each state is 500ms and the above pattern continues forever. Hardwares Required  AVR Trainer Board-100-1pcs  AVR USB Programmer-1pcs  12V DC Adapter-1pcs  10 to 10 FRC Female Connector-2pcs  USB AM-AF Cable(Optional)-1pcs Softwares Required  AVR Studio 4  WinAVR -2010  SinaProg Hex Downloader  USBasp Driver 3
    • ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 C Program //**************************************************************// //Microcontroller :ATmega16 //System Clock :1MHz //Project :LED pattern 8 with ATmega16 //AVR Compiler :AVR-GCC 4.3.2 //Author :ABLab Solutions // :www.ablab.in // :info@ablab.in //Date :1st January 2012 //**************************************************************// #include<avr/io.h> /*Includes io.h header file where all the Input/Output Registers and its Bits are defined for AVR microcontroller*/ #define F_CPU 1000000 /*Defines a macro for the delay.h header file. F_CPU is the microcontroller frequency value for the delay.h header file. Default value of F_CPU in delay.h header file is 1000000(1MHz)*/ #include<util/delay.h> /*Includes delay.h header file which defines two functions, _delay_ms (millisecond delay) and _delay_us (microsecond delay)*/ void main(void) { DDRB=0xff; /*All pins of PortB are declared output (LED array is connected)*/ /*Start of infinite loop*/ while(1) { PORTB=0x00; /*All LEDs are Off*/ 4
    • ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 _delay_ms(500); /*500ms delay*/ /*For loop for LED pattern 7*/ for(unsigned char i=0;i<4;i++) { PORTB=(0x10<<i) | (0x08>>i) | PORTB; /*Left shifting 0x08, right shifting 0x10 and making OR operation with PORTB*/ _delay_ms(500); /*500ms delay*/ } } } /*End of Program*/ Connection Guide The step-by-step procedures for LED pattern 8 with ATmega16 are as follows:  Insert the DC Pin of 12V DC Adapter to the DC Socket of AVR Trainer Board-100.  Connect PORTB Header with LED Header in AVR Trainer Board-100 with a 10 to 10 FRC Female Connector.  Connect the ISP Header of AVR Trainer Board-100 with AVR USB Programmer Header with a 10 to 10 FRC Female Connector.  Connect the AVR USB Programmer to the PC/Laptop’s USB Port.  Switch on the power with the help of Power Switch of AVR Trainer Board-100.  Download the LED pattern 8 with ATmega16 Hex file to AVR Trainer Board-100 with the help of SinaProg and AVR USB Programmer.  See the Result. 5
    • ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 Update Yourself For more Softwares, Tutorials, Sample Codes, Installation Guides, User Guides, User Manuals, Videos, Products & Components and Updates, Please Visit us at: www.ablab.in Mail us at: Info@ablab.in View us at: www.youtube.com/ablabsolutions Like us at: www.facebook.com/ablab.in Join us at: www.facebook.com/groups/ablabsolutions 6