Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)
Paste
Pasted as C by maxEmbedded ( 13 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