pallavishanta
Newbie level 3
- Joined
- May 14, 2012
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,300
Hi all,
Am using an atmega64a controller and 8MHz crystal and am beginner to avr timers.. can any one pls help me how to use timer3.. i just want to start a timer3 for 10s and once timer is expired i just want to blink led.
Am using an atmega64a controller and 8MHz crystal and am beginner to avr timers.. can any one pls help me how to use timer3.. i just want to start a timer3 for 10s and once timer is expired i just want to blink led.
Code:
void start_timer3(unsigned int delay)
{
timer3_delay = delay * 10
ETIMSK |= ( 1 << TOIE3);
TCNT3 = // what value must be assigned here confused;
TCCR3B |= (1 << CS32) | (1 << CS30); /* select prescalar of 1024 */
timer3_expired = 0;
tmr3_count = 0;
}
ISR(TIMER3_OVF_vect)
{
TCNT3 = // this is what where am stucking am not getting what should be the timer/counter tcnt3 value to be assigned;
tmr3_count++;
if(tmr3_count >= timer3_delay)
{
timer3_expired=1; // need to reboot gsm and controller.
tmr3_count=0;
blink_led();
}
}
Last edited: