i can give u a direct code for atmeaga32...it started with atmega16 but the structure of 16 and 32 are completely same..
# include<avr/io.h>
int main(void)
{
DDRD=0x01;
TCCR1B|=((1<<CS10)|(1<<CS11));
while(1)
{
if(TCNT1>=3000)
{
PORTD^=(1<<2);
TCNT1=0;
}
}
return(1);
}
this is flashing led with 1 sec gap