Premnagar Dehradun 248007 UK
+91-9927715123
info@smedehradun.com, schematicslab@gmail.com

Basic Embedded System- Lecture 1- Glowing/ blinking of LED using Atmega16

Your Problem, Our Solution

Basic Embedded System- Lecture 1- Glowing/ blinking of LED using Atmega16

In the first lecture of basic embedded system, we start with
the glowing of led using binary operator. We are using Atmega 16 Microcontroller
to operate the led.
For the software development, we are using AVR Studio4 professional
& Proteus ISIS Professional for the Simulation.
AVR Studio4 Professional 

Proteus professionl ISIS
Connect the hardware as shown in to the figure. LED is
connected with pin 0 of PORT B. 
Please remember, when you connect the hardware,
it is essential to know about the voltage of LED. If you are using 3.3V LED,
Then please use 330 Ohm resister with LED.
We write the program in AVR studio 4 programming window as written
below-
#include<avr/io.h>
// #include<util/delay.h>
//PROGRAM TO RUN SINGE LED
void main()
{
DDRB=0b00000001;
PORTB=0b00000001;
}
This program glow the led continuously using Atmega 16.
if we want to blink the LED with 2 second of delay, the use below written program to blink the LED. We provide delay of 2 second (2000 millisecond) between on & off the LED.
#include<avr/io.h>
#include<util/delay.h>
//PROGRAM TO RUN SINGE LED of & off
void main()
{
//DDRB=0xFF;
DDRB=0b00000001;
while(1)
{
PORTB=0b00000001;
_delay_ms(2000);
PORTB=0b00000000;
_delay_ms(2000);
}
}
you can use same fundamentals to blink multiple LEDs or different pattern like shown below. 
For any assistance, please feel free to contact us here.
you can also join our tutorial lecture at our Facebook page

 

error: