Welcome, guest! Login / Register - Why register?
[email protected] webmail now available. Want one? Go here.
You will not find us on Bing and you will get a bounce when you try registering with an outlook/live.com email address here. Not our fault. Blame the corporate bully. #deeznutsmicrosoft

Paste

Pasted as C by maxEmbedded ( 9 years ago )
#include <avr/io.h>
#include <util/delay.h>

void timer_init()
{

TCCR0B |=(1<<CS00);  //PRESCALLER SET
TCNT0 = 0xfffa;  // TIMERCOUNT=0.5m/0.125u=4000 TIMER COUNT
TIMSK0 |=(1<<TOIE0); //TIMER INTERRUPT ENABLE FLAG
TIFR0 |=(1<<TOV0);  //TIMER OVERFLOW FLAG
sei();  //enable global interrupt

}

ISR(TIMER0_OVF_vect)
{
PORTB0 |= ~ (PORTB0) ;
}

int main(void)
{

DDRB |=(1<<0);

timer_init(); //function call

while(1)  //loop forever
{

}

}

 

Revise this Paste

Your Name: Code Language: