Is the right init for Timer0 ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Visit site
Activity points
9,442
Guys,

Is it the right init for Timer0 in ATMEGA128 ?
Code:
/ Initial ATMega128 Timer/Counter0 Peripheral
	
	TCCR0=0x00;                  // Normal Timer0 Operation
	//TCCR0=(1<<CS02)|(1<<CS00);   // Use maximum prescaller: Clk/1024
	TCCR0 = (5<<CS00);            //Timer clock = div1024 
	TCNT0=0x94;                   // Start counter from 0x94, overflow at 10 mSec
	TIMSK=(1<<TOIE0);            // Enable Counter Overflow Interrupt
	sei();                        // Enable Interrupt

and call the interrupt like this :
Code:
ISR(TIMER0_OVF_vect)


Thanks
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…