Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Is the right init for Timer0 ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top