LED BLINK USING ATMEGA16(AVR CODE WITH PROTEUS SIMULATION)
#include <avr/io.h>
#include<util/delay.h>
int main(void)
{
DDRC=0b11111111;
while(1)
{
PORTC=0b11111111;
_delay_ms(2000);
PORTC=0b00000001;
_delay_ms(1000);
PORTC=0b00000010;
_delay_ms(1000);
PORTC=0b00000100;
_delay_ms(1000);
PORTC=0b00001000;
_delay_ms(1000);
PORTC=0b00010000;
_delay_ms(1000);
PORTC=0b00100000;
_delay_ms(1000);
PORTC=0b01000000;
_delay_ms(1000);
PORTC=0b10000000;
_delay_ms(1000);
PORTC=0b11111111;
_delay_ms(2000);
}
}
#include<util/delay.h>
int main(void)
{
DDRC=0b11111111;
while(1)
{
PORTC=0b11111111;
_delay_ms(2000);
PORTC=0b00000001;
_delay_ms(1000);
PORTC=0b00000010;
_delay_ms(1000);
PORTC=0b00000100;
_delay_ms(1000);
PORTC=0b00001000;
_delay_ms(1000);
PORTC=0b00010000;
_delay_ms(1000);
PORTC=0b00100000;
_delay_ms(1000);
PORTC=0b01000000;
_delay_ms(1000);
PORTC=0b10000000;
_delay_ms(1000);
PORTC=0b11111111;
_delay_ms(2000);
}
}
Comments
Post a Comment