dsk2858
Member level 2

- Joined
- Aug 17, 2011
- Messages
- 47
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Chennai,India
- Activity points
- 1,683
Mr BigDog
i gone through ur profile i found that ur also familiar with AVR.
i am using AVR studio-4 to blink an led for 10seconds
when a button is pressed connected to PORTB.
for that purpose i am using #include<util/delay.h> header file.
the program is being compiled and hex file was genereted . i am simulating this by using PROTUS ISIS profetional.
but when i am pressing the button the led is not blinking more than 1second even less.
CODE:
could you please help me regarding this problem
i gone through ur profile i found that ur also familiar with AVR.
i am using AVR studio-4 to blink an led for 10seconds
when a button is pressed connected to PORTB.
for that purpose i am using #include<util/delay.h> header file.
the program is being compiled and hex file was genereted . i am simulating this by using PROTUS ISIS profetional.
but when i am pressing the button the led is not blinking more than 1second even less.
CODE:
Code:
#include<avr/io.h>
#include<util/delay.h>
void delay_ms(unsigned int d)
{
_delay_ms(d);
}
int main(void)
{
DDRB=0x00;
DDRC=0xFF;
while(1)
{
if(PINB==0x01)
{
PORTC=0x03;
delay_ms(10000);
PORTC=0x00;
}
if(PINB==0x02)
{
PORTC=0x01;
}
}
return 0;
}
could you please help me regarding this problem