Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as C by maxEmbedded ( 11 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